An openly gay Democrat has been elected as the mayor of Long Beach, California.

Robert Garcia, who is also the city’s first Latino mayor, and at 36 the city’s youngest, narrowly defeated opponent Damon Dunn in yesterday’s election, with 52.1% of the of the vote, to Dunn’s 47.9%.

There were less than 2,000 votes between the two candidates, who received 23,296 and 21,398 votes respectively

Garcia, who has served on the city’s council since 2009, will replace outgoing Long Beach mayor, Bob Foster.

He told reporters: “I think you run, not necessarily to be the first, I know that there are certainly historical implications of my election.

“I’m in this to be mayor of everyone, no matter the age or the colour of their skin or who they love.

“Long Beach will continue to be a place that supports working people. I’m incredibly grateful and honoured to have been elected.

Conceding to Garcia, Dunn said: “He will be a fantastic mayor. The city of Long Beach is lucky to have him.

“This is Robert’s moment and he deserves it.”

Also today, openly gay Republican candidate Carl DeMaio won a Republican primary in the state, furthering his bid to represent California’s 52nd congressional district in the House of Representatives.

Last year, Long Beach Representative Alan Lowenthal flew the rainbow flag from his office, to commemorate the Supreme Court case that would eventually strike down the Defence of Marriage Act.