Updated

Republican U.S. Rep. Martha McSally conceded Arizona's U.S. Senate race to Democratic Congresswoman Kyrsten Sinema on Monday after the latest vote count showed McSally trailing by more than 38,000 votes out of more than 2.2 million ballots cast.

"Congrats to @kyrstensinema. I wish her success," McSally tweeted from her official campaign account. "I’m grateful to all those who supported me in this journey. I’m inspired by Arizonans’ spirit and our state’s best days are ahead of us."

"As long as I’ve served Arizona, I’ve worked to help others see our common humanity & find common ground," Sinema tweeted soon after McSally conceded. "That’s the same approach I’ll take to representing our great state in the Senate, where I’ll be an independent voice for all Arizonans.

"Thank you, Arizona. Let's get to work."

Sinema's victory means that Democrats have flipped the seat previously held by retiring Republican Sen. Jeff Flake. Democrats now have 47 Senate seats, while Republicans have 51. The final makeup of the Senate will be determined following a recount in Florida and a Nov. 27 runoff election in Mississippi.

Flake tweeted congratulations to Sinema "on a race well run, and won," adding "You'll be great."

Sinema, a three-term congresswoman, is Arizona's first Democratic U.S. senator since 1994. McSally, a former Air Force pilot who embraced President Donald Trump after opposing him during the 2016 elections, had claimed that Sinema's anti-war protests 15 years ago disqualified her and said one protest amounted to "treason."

But during her six years in Congress, Sinema built one of most centrist records in the Democratic caucus, and she voted for bills backed by Trump more than 60 percent of the time. She backed legislation increasing penalties against people in the country illegally who commit crimes.

In remarks to supporters, Sinema paid tribute to the late Republican Sen. John McCain, who died this past August.

Sinema said the former prisoner of war and GOP presidential nominee was "irreplaceable" and "taught us to assume the best in others, to seek compromise instead of sewing division, & to always put country ahead of party.”

"As your Senator, that’s exactly what I'll do," Sinema went on. "Not by calling names or playing political games, but by showing up and doing the work to keep Arizona moving forward."

McSally's attacks on Sinema reached back more than 15 years to when Sinema was a Green Party spokeswoman and liberal activist.

McSally backed Trump's tax cut, border security and the repeal of ObamaCare as she survived a three-way GOP primary in August, defeating two conservative challengers who claimed her support for Trump was fake. McSally also campaigned on her military record and support for the armed forces.

Sinema attacked McSally's leadership of last year's failed ObamaCare repeal effort as a sign that she would not protect Arizona residents with pre-existing medical conditions. McSally argued that she would protect patients, despite her vote on the bill that would have removed many of those protections.

The Arizona contest drew more than $90 million in spending, including more than $58 million by outside groups, according to Federal Election Commission reports. Attack ads by both sides clogged the airwaves for months.

Sinema, 42, has a law degree, worked as a social worker and was a political activist in her 20s, running as an independent Green Party candidate for the Arizona House. She then became a Democrat and served several terms in the state Legislature. Sinema started as an overt liberal but developed a reputation for compromise among her Republican peers, laying the groundwork to tack to the center. She was elected to represent Arizona's newly-created 9th Congressional District in 2012.

McSally, 52, was the first female Air Force pilot to fly in combat, flying A-10 attack jets. She also was the first woman to command a fighter squadron, again in A-10s.

McSally lost her first race in Arizona's 2nd congressional district in 2012 when she was narrowly defeated by Democratic Rep. Ron Barber, who replaced Rep. Gabby Giffords after she was wounded in a 2011 assassination attempt. But McSally came back to win the 2014 election, beating Barber by a narrow margin and was re-elected in 2016.

Flake was an outspoken critic of Trump and announced in 2017 that he would not seek re-election, acknowledging he could not win a GOP primary in the current political climate. His support of the president's initiatives, however, was mixed. He strongly backed last year's tax cut bill but criticized Trump's positions on free trade.

The Associated Press contributed to this report.