YORK, Pa. — Tom Wolf was reelected governor of Pennsylvania on Tuesday, cruising to a second term over a Republican opponent who never managed to build a coherent case against the incumbent Democrat.

Wolf's win over Scott Wagner ensures that Democrats will wield the threat of a veto over everything from restrictions on abortion rights to the congressional maps drawn in 2021 for the next round of redistricting.

But the governor will still have to contend with a GOP-dominated legislature: Though Democrats were expected to make gains in both the state House and Senate on Tuesday, Republicans appeared set to maintain solid majorities. That means Wolf will have to continue striking a conciliatory tone to push through his policy priorities.

In doing so, he will have a new partner in the Capitol: John Fetterman, the liberal mayor of Braddock, outside Pittsburgh, who ran on the ticket with Wolf, was elected lieutenant governor. Wolf was far ahead with the majority of precincts reporting, according to unofficial returns.

"What you did is make a great future for Pennsylvania," Wolf, speaking in a renovated industrial venue in downtown York, told a room crowded with supporters Tuesday night. "You voted for better lives. You voted to hold on to our democracy. You voted to continue to make our schools better. You voted for access to quality and affordable health care."

He continued: "You voted to make Pennsylvania a fairer place for everybody, regardless of color of skin, regardless of who you love, regardless of the religion you profess, regardless of your gender."

The results showed the limitations of embracing Trump's pugilistic style, as lesser-known candidates like Wagner, a former state senator and owner of a waste-hauling business, tried but failed to replicate the president's no-holds-barred approach. Falling further behind than Wagner were Green Party candidate Paul Glover and Libertarian candidate Kenneth Krawchuk.

Wagner told supporters that he "traveled every corner of the state" and had some experiences that "no amount of money could ever buy," including buying a pig at a county fair for $40 a pound. "I expected the outcome to be different," he said.

For his part, Wolf, 69, stuck to a largely conservative strategy, running on his record of investing more money in public education, expanding Medicaid, and blocking GOP-led efforts to restrict abortion rights, but saying almost nothing about what his second-term agenda would be.

But the Wolf campaign crushed Wagner on the airwaves, having outspent the Republican by a nearly 4-1 ratio between June and late October, according to campaign-finance records. Overall, Wolf raised about $30 million for his reelection bid, nearly double Wagner's $16 million. Wagner, who lent his campaign millions, spent much of his haul during the Republican primary.

In television ads, Wolf's campaign depicted him as a "different" kind of governor who refuses gifts from lobbyists and drives his Jeep to the state Capitol. That was similar to the image Wolf cultivated in his first campaign four years ago.

He also presented himself as a steady-handed steward of the state's finances, even as he spent much of his first four years locked in a stalemate with Republicans over the budget.

With the exception of this year, every state budget deal was painfully crafted – and perpetually landed past the deadline to enact new fiscal plans. But the governor learned early that proposing bold changes in the way the state taxes residents, as he did in his first budget, was a battle he was not going to win with the legislature.

He shifted his focus to programs and issues where he could strike compromises, including boosting funding for public education, bolstering the state's response to the heroin and opioid crisis, toughening up penalties for hazing, and strengthening animal abuse laws.

Wolf also found compromises with Republicans on other key policy issues, including bills to legalize medical marijuana, rein in the skyrocketing cost of public pensions, and relax the state's iron grip over the sale of wine.

After Trump's win in Pennsylvania in 2016, though, some saw an opening against the governor.

Wagner, 63, who was elected to the state Senate on a historic write-in campaign in 2014, declared his candidacy for governor around the same time Trump was inaugurated.

Even as Wagner emerged as the GOP nominee in May — winning an expensive and nasty primary campaign in which one opponent aired a television ad calling him a "deadbeat dad" — he struggled to unite the party.

Prominent Republican donors, like the Montgomery County power broker Robert Asher, were irked by Wagner's Trump-like style and refused to raise money for him.

The campaign had other problems.

Strategists in both parties said Wagner failed to develop a defining message against Wolf, who doesn't inspire strong negative opinions among voters, according to polling by Franklin and Marshall College.

Even when Wagner did settle on a theme — eliminating school property taxes, for example — he committed a number of unforced errors, most notably last month by live-streaming a video of himself on the side of a road threatening to "stomp all over" Wolf's face with golf spikes.

Wagner later said that he had chosen a "poor metaphor" and that his remarks weren't meant to be taken literally. But the episode played into a criticism that Wagner was angry.

He built his political brand as a small businessman who knew how to eliminate profligate government spending and would take on job-killing bureaucrats. But by the end of the governor's race, trailing far in the polls, Wagner all but abandoned that core theme and instead embraced Trump's nationalism.

The title of his final TV ad? "Caravan."

Liz Navratil of the Harrisburg Bureau contributed to this article.