Tennessee Republican Marsha Blackburn beat out Democrat and former governor Phil Bredesen in a closely watched race for a US Senate seat that included a surprise endorsement from Taylor Swift.

With more than 90% of precincts reporting Tuesday night, Blackburn was leading Bredesen 56 to 43%.

"I want the volunteers & the campaign staff to know just how much I appreciate them," Bredesen tweeted on Tuesday night after his defeat.

"I am encouraged by the energy, especially of the young people involved in this campaign, and what that will mean for the future of our state. Don’t be discouraged, stay engaged, and never give up."

The battle for Tennessee had been one of the most competitive Senate races in the country. The seat became open when Sen. Bob Corker — an on-again, off-again Republican critic of the president — announced he would not seek reelection.

Blackburn, who has served as her state’s representative for the 7th Congressional District since 2003, easily won the GOP primary. She continued to campaign as a staunch ally of President Donald Trump, and spent the final few days leading up to Election Day echoing the president’s dire words about immigrants and Democrats.

“What Tennesseans want to see is someone who is going to be there to support President Trump,” she told BuzzFeed News last week, “and somebody that is going to get things done that they want to see done: securing the border, lowering taxes, lessening regulation, funding our military, honoring our veterans, reducing and doing something about the federal debt.”

Bredesen, a moderate former governor and Nashville mayor, was the Democrats’ top choice to run in the state, with polls over the summer showing him running neck-and-neck with Blackburn. In contrast to his opponent’s focus on the president, Bredesen kept his campaign’s focus on local issues, such as the opioid crisis, in a bid to convince voters to look past party affiliation.

“I’m not here to be against Donald Trump or for anybody or anything else,” he told voters last month. “If the president is trying to do something that I think is good for Tennessee and Tennesseans, I need to be there with him to try and do something.”

Traditionally, Tennessee is a state that votes red. According to a recent NBC News–Marist poll, 43% of likely voters identify as Republicans, while President Trump won the state in 2016 by a whopping 26 points.

Drew Angerer / Getty Images

The race received national attention when Tennessee native Taylor Swift, who has tended to remain politically silent in the past, surprised her fans in October with an endorsement for Bredesen and Democratic Rep. Jim Cooper. Cooper was reelected to Tennessee's 5th congressional district on Tuesday.

The singer-songwriter posted a lengthy Instagram caption to her 112 million followers endorsing the two candidates in September. In her post, Swift also said she couldn’t support Blackburn because of her conservative record on women’s and LGBT rights.

President Trump was less magnanimous. “Let’s say that I like Taylor’s music about 25% less now, OK?” he told reporters.

Mike Huckabee, the former Arkansas governor and father of Trump’s press secretary, mocked Swift’s endorsement. “So @taylorswift13 has every right to be political but it won’t impact election unless we allow 13 yr old girls to vote,” he tweeted.

But Swift’s Instagram post, which encouraged fans to register to vote on Vote.org, led to an unprecedented flood of new registrations, according to the website.

“We are up to 65,000 registrations in a single 24-hour period since T. Swift’s post,” said Kamari Guthrie, director of communications for Vote.org. That was more than the 56,669 who registered in the entire month of August.

Registrations also spiked in Tennessee. By Oct. 8, the organization had received 5,183 registrations in the state — at least 2,144 of which were in the 36 hours after Swift’s post, according to Guthrie. That was up from 2,811 new Tennessee voter registrations for the entire month of September, and just 951 in August.

“Thank God for Taylor Swift,” said Guthrie.

Swift also encouraged people to vote early in Tennessee and in states across the country that offered the option. She asked fans to post photos of themselves on Instagram and use the #justvoted hashtag. A search of the hashtag yielded more than 20,000 results.

Megan Casey, a 36-year-old Nashville resident, told BuzzFeed News last week that she thinks Swift inspired people to get out and vote.

"I think her post probably inspired people who were already supporting one candidate, but may not get around to voting because they don’t think it’s that important,” Casey said.

"I think she inspired those people to follow through with voting."

Krystie Yandoli is an entertainment editor for BuzzFeed News and is based in New York.