MADISON, Wis. — Republican Sen. Ron Johnson, defying polls and public perception that he was destined to be ousted after just one term, defeated Democrat Russ Feingold on Tuesday for the second time, winning re-election in one of the nation's most closely watched Senate races.

Johnson, the Oshkosh manufacturer who rode a tea party wave to victory in 2010, becomes the first Republican to win election to the Senate in Wisconsin in a presidential year since 1980. Feingold, whose 18-year Senate career was ended by Johnson in 2010, was trying to become the first senator in 82 years to defeat the same person who knocked them out of office.

It was not meant to be.

Johnson won by 7 points, based on unofficial results.

Johnson told The Associated Press he won because "I told the truth."

"I think the good folks of Wisconsin recognized that," Johnson said in a telephone interview before he spoke to supporters in Oshkosh. "I've been working my tail off for the last six and a half years."

Johnson said he won because people are concerned about the direction of the country.

"They are not happy with what's happened in Washington, D.C.," Johnson said. "They see a dysfunctional system. Donald Trump obviously conveyed that. People were looking for change. They didn't see somebody who was in politics for 34-plus years, either Secretary (Hillary) Clinton or Sen. Feingold, as someone who would deliver the change they were looking for."

Feingold delivered a dour message to his supporters.

"This could be one of the most challenging times in the history of the country," he said. He urged them to "be as restrained as you can be."

Johnson had been insisting that the race was tightening and he had the momentum, even though polls consistently showed him trailing Feingold. Johnson branded Feingold a phony in the waning days of the race, as millions of dollars in outside money poured in on both sides in the tightening contest.

Steffi Musa, a 57-year-old nurse from Madison, voted for Johnson.

"I used to vote for Russ Feingold years and years ago and I think he was pretty good," she said. "But I thought it was time for a change in 2010. I thought about giving Feingold another chance, but when it came down to it I stuck with Johnson."

Gabriel Chavez, a 53-year-old middle school teacher from Madison, Wisconsin, voted for Feingold.

"I like what he did when he was in the Senate before," Chavez said of Feingold. "Ron Johnson, I don't think he's done much. Johnson has definitely proved he's not worthy of my vote. I don't see that he's done anything for me country or state."

Johnson pitched himself as the outsider businessman, even though he has spent the past six years in the Senate. He played up his manufacturing background, while branding Feingold as a Washington insider career politician who had achieved little over his previous 18 years in the Senate.

Feingold argued that the millionaire Johnson would never side with the working class on issues such as raising the minimum wage, reducing college loan debt and opposing free trade deals that ship jobs overseas. Johnson said it was his private-sector experience that set him apart from Feingold. Johnson, chairman of the Senate's Homeland Security Committee, also tried to make national security a central theme, saying Feingold was ill-equipped to fight terrorism overseas or at home.

The presidential race cast a long shadow on the rematch, with each candidate challenging the other to defend his support for his party's nominee. Johnson stuck by Trump, even as other Republicans in similarly tight re-election contests backed away from him. Feingold, too, stood by Clinton, while refusing to say whether he voted for her in Wisconsin's primary and while campaigning with her running mate, Tim Kaine, and Vermont Sen. Bernie Sanders in the general election.