FALL RIVER — Mayor Jasiel F. Correia II of Fall River, facing the political fight of his life, delivered a stunning victory Tuesday night as voters ousted him from office in a recall election and then ushered him back into power by picking him to be the city’s next chief executive.

Correia, a 27-year-old Democrat, held onto his job under a quirk in the city charter which allowed him to run for reelection on the same ballot that sought to recall him. He was the second Fall River mayor to face a recall since 2014, when William Flanagan was forced to leave office.

The ballot asked voters to decide two questions: Whether to recall Correia and whom to elect as the next mayor.

More than 60 percent of the voters recalled Correia, with 7,829 in favor of the recall and 4,911 against, but he will remain in office because he finished first in a five-way race for the city’s top job. Also running for mayor were longtime City Councilor Joseph D. Camara, School Committee member Paul Coogan, school administrator Kyle Riley, and Erica Scott-Pacheco, director of development at a legal services nonprofit.

Correia garnered 4,808 votes, or about 35 percent of the votes. Coogan received 4,567 votes, or 33 percent. Camara finished behind Coogan with 1,971 votes, followed by Riley with 1,460 votes and then Scott-Pacheco who collected 740 votes.

An exuberant Correia celebrated his victory with supporters at Barrett’s Waterfront. “I am honestly overwhelmed and everyone in the room knows I’m usually not speechless,” he said. “Today I am speechless.”

He promised to bring the city more police officers, firefighters, and teachers, improve roads, and boost economic development.

“It’s because of you we won this election. We’re going to win another one in November,” he said. “We’re going to keep winning! We’re going to keep winning! We are going to make Fall River, Massachusetts the best city in the Commonwealth of Massachusetts!”

A group known as Fall River Recall organized the effort to remove Correia after a federal grand jury indicted him last year on fraud and tax evasion charges related to his tech startup SnoOwl. An attempt by the City Council to remove Correia from office while his criminal case was pending failed by a vote of 5 to 4 in November, though councilors overwhelmingly approved a no-confidence vote and requested his resignation. Correia refused to step down.

Coogan addressed supporters at Scotties Pub on Tuesday night and hinted he would try to unseat Correia in the fall during the city’s biennial election. “I’m a tad upset and I’m looking at September,” said Coogan, as the crowd began to chant his name.

John Paiva, a construction worker who has lived in Fall River for 40 years, said he voted against the recall. He said the criminal charges Correia faces have no bearing on his ability to run the city.

Even with this win, Correia faces an uphill climb in the coming months as federal prosecutors press ahead with the criminal case.

An interim status conference in Correia’s fraud and tax evasion case is scheduled for April 23 in US District Court in Boston. Correia’s predicament stands in stark contrast to his historic rise to power in 2015 when at age 23 he became the youngest mayor in Fall River’s history.

On Oct. 11 , FBI agents arrested Correia on charges he defrauded investors who supported SnoOwl and then attempted to conceal the scheme by filing false tax returns.

The tech startup, which Correia established while he was an undergraduate at Providence College, developed a smartphone app to connect businesses and consumers.

Federal prosecutors allege Correia spent more than $231,000 that investors gave him for SnoOwl on expensive travel, casinos, adult entertainment, and a luxury car.

Correia has pleaded not guilty. Last month he asked a judge to let him contact SnoOwl’s investors and repay them.

In his request, Correia’s lawyer said there was $306,000 available in escrow to make the payments.

Correia withdrew the request March 5, drawing a rebuke from federal prosecutors who questioned the timing and motivation behind the mayor’s original offer. Assistant US Attorney Zack R. Hafer criticized Correia for asserting that prosecutors were refusing to facilitate the payments and wrote that his offer to repay investors was a “remarkable about-face” for the mayor.

A lucky break helped Correia get his start in Fall River politics. He ran for City Council in 2013, finishing 10th in a field of 18 for nine seats. But he got on the council anyway after one member left to take a job with city government.

Eight months later, Correia found himself at the center of a political firestorm. City residents, enraged over firefighter layoffs and a pay-as-you-throw trash program, sought to recall Flanagan. Correia signed the recall petition.

A few days later, Correia said Flanagan asked him to meet late at night in his car, where, Correia said, Flanagan placed a gun on the dashboard while trying to persuade Correia to withdraw his name from the petition, according to a special prosecutor’s report.

Flanagan denied the accusation, and no charges were filed in the incident. Flanagan was recalled, and Sam Sutter, then-Bristol district attorney, was elected mayor in a special election.

A year later, in 2015, when Sutter’s term was up, Correia ran against him and won on a 8,373-to-7,721 vote.