The race to be Arizona’s next secretary of state hangs by a thread.

Democrat Katie Hobbs overtook Republican businessman Steve Gaynor for a short time Sunday night, but additional votes put Gaynor back in the top spot by less than 300.

The gap between them is 0.02 percent. More than 2 million votes have been counted so far.

Hobbs, a state senator from Phoenix, took the lead when Maricopa County reported its latest tally at 5 p.m.

But Gaynor, who has led the race since Tuesday, retook the No. 1 spot when red-leaning Pinal County later updated its tally.

Hobbs has steadily closed the gap with Gaynor as more votes come in from the state's urban areas.

MORE:Here's how to check if your early ballot was counted in Maricopa County

Roughly 162,000 votes remain to be counted in Maricopa County. About 211,00 remain statewide; more updates are expected next week.

An additional 36,000 votes from Maricopa County were tallied Sunday.

The Associated Press called the race for Gaynor on Tuesday night, but he never declared victory outright. It was not immediately clear Sunday if the AP plans to retract its projection.

Under Arizona law, an automatic recount is triggered if the final gap between statewide candidates is less than or equal to the lesser amount of one-tenth of 1 percent, or 200 votes.

"It's a close race," Gaynor told supporters on Tuesday. "We're going to fight to the end, and hopefully, when the race is called, we'll be victorious."

MORE: Here's why there are still so many votes left to count in Arizona

Hobbs' campaign criticized the Associated Press for the projection given the thin margin and hundreds of thousands of uncounted ballots.

In Arizona, the secretary of state is the No. 2 statewide-elected official, next in line to succeed the governor if he or she leaves office early. That has happened four times since the late 1970s.

The secretary of state's primary duty is managing the statewide elections system, which has faced a string of problems in recent years.