Democrat David Alvarez saw his bid to become San Diego's first Latino mayor in the modern era thwarted by his Republican city council colleague Kevin Faulconer.
With 100 percent of the votes counted, Faulconer obtained 54.5 percent, compared with 45.5 percent for Alvarez.
Residents of California's second city went to the polls in November for a special election to replace Mayor Bob Fillner, who resigned in a sexual harassment scandal.
Faulconer finished first in a field of 11 candidates, taking 43 percent of the vote, short of the absolute majority required to win.
Alvarez, with 25 percent of the vote, edged out fellow Democrat Nathan Fletcher to qualify for Tuesday's runoff.
Together, the two Democrats outpolled Faulconer in November, but some of those Democratic votes melted away in the runoff.
The Hispanic candidate emerged to speak with supporters who gathered in the community of Barrio Logan before the results of the balloting were made known.
Alvarez, 33, thanks his volunteers for their support and elected leaders for their backing and for sticking with him during the campaign.
Accompanied by his wife and daughter, he said that the most important thing about the campaign was its unity and progressive vision.
After learning of the official results, Alvarez conceded shortly before midnight and used the social networks to congratulate Faulconer, who will serve the three years left in Fillner's term.
After being informed that he had won, Faulconer said that he was anxiously awaiting becoming the new mayor of the country's eighth largest city.
This was the first time that a Latino candidate ran for San Diego mayor, a fact that motivated many Hispanics to go to the polls, although they did not manage to become the key to the election that some analysts had anticipated.
The fact that Alvarez was in the race appears to have brought Hispanics to the polls in greater numbers than otherwise might have been the case, although only about 251,000 out of the 683,370 registered Latino voters actually cast ballots in the second round. EFE