Pony-tailed Spanish politician Pablo Iglesias abruptly retired from politics on Tuesday night, a month after stepping down from his post as deputy prime minister of the central government.

The 42-year-old founder of the leftist Podemos party made a surprise move a few weeks ago to run in the capital region's elections, which ended in a landslide victory for conservative candidate Isabel Díaz Ayuso on Tuesday night.

"I'm leaving all party politics ... I won't be an obstacle for the renewal of leadership our political force needs," Iglesias told reporters late on Tuesday after learning the results, which he described as a tragedy.

"We have failed," he said.

Eventually, Podemos and the Socialists formed Spain’s first coalition government - but a year and a half on, having announced his retirement, Iglesias has tapped Labour minister, Yolanda Díaz, as his successor.