Democratic candidate Catherine Cortez Masto has won the Nevada Senate race.

The Associated Press called the race for Cortez Masto, the state’s former attorney general, with 29 percent of precincts reporting. Cortez Masto took 49 percent, while her Republican opponent Joe Heck received 44 percent of the vote.

The surprise announcement of Senate Minority Leader Harry Reid’s retirement gave Republicans the opportunity to control both Nevada Senate seats. Heck initially led the race, taking the lead in every poll taken in July through mid-October.

Heck took a dive, however, when he disavowed Trump after a tape was leaked in which the Republican presidential candidate could be heard making lewd remarks. Heck also chose to focus his campaign largely on attacking Reid’s record, rather than his opponent, Cortez Masto. Cortez Masto, however, focused her campaign largely on attacking Trump.

By the final days of the race, however, it seemed that Heck had regained his edge, and the polls suggested a neck-and-neck race, with each taking the lead in three of the final six polls taken in the state. The final RealClear poll aggregate on the eve of the election had Cortez Masto leading Heck by a hair of only .4 percent — 46.7 to 46.3 percent.