By Angus Berwick and Sarah White

MADRID (Reuters) - Spanish caretaker Prime Minister Mariano Rajoy said on Monday he would reach out to rivals in a bid to quickly form a government after his conservative party strengthened its lead in elections on Sunday, though still far short of a majority.

As Europe enters uncertain waters with Britain's historic decision to exit the European Union, Spanish parties are under pressure to avoid the protracted, ultimately fruitless negotiations that followed an inconclusive December ballot.

Against expectations, Rajoy's center-right People's Party (PP) was the only one to make gains in another hung parliament as voters flocked back to mainstream parties and abandoned newcomers that did well in December.

But while the results lent the PP some momentum in talks with other leaders, it still faced difficult options. They included trying to rope in the PP's long-time foes, the second-placed Socialists, to support or at least enable a conservative-led government.

The PP wound up with 137 seats on Sunday, up from 123 in December. But 176 are required for a majority to govern alone.

"What Spain needs, and it needs it now, is a government with a strong parliamentary backing, able to generate confidence within and outside Spain, able to take on the reforms that Spain still needs and give stability to Europe at a time when it needs it," Rajoy said as he called on other parties to join a "grand coalition" of center-left and center-right parties.

He said he hoped to reach a deal with other parties on such an administration within a month.

A smaller liberal party, Ciudadanos (Citizens), seen as a more natural ally of the PP, won 32 seats. A leftist anti-austerity alliance, Unidos Podemos (Together We Can), which was originally forecast to overtake the Socialists, came third on 71 seats.

Many voters were confident some form of deal would be easier to reach now the PP has a stronger hand than polls forecast.

"It was a big surprise, but now at least there's a chance of some stability," said self-employed energy specialist Fernando Cierva, 52, as he walked his dog in central Madrid, adding he had voted for Ciudadanos.

WEAK GOVERNMENT

It is unclear how Rajoy may engineer this majority, however.

The Socialists were divided on Monday on whether they should allow the PP to govern. Meanwhile, Albert Rivera, the youthful leader of Ciudadanos, said he was willing to have talks with the PP but not to back a government headed by Rajoy.

Political experts believe this situation could lead to a minority government of the PP allowed by the Socialists and Ciudadanos through abstentions from votes of confidence.

This administration would be potentially fragile but Rajoy said he would not rule it out if he could not convince other parties to back him for a new term.

Spain's economy, the euro zone's fourth largest, has so far proven immune to any contagion from prolonged political uncertainty, but it cannot remain so indefinitely, analysts say.

"A minority government may not be able to pass material reforms, as it would require unlikely support from a fragmented parliament. In our view, such inertia would hurt Spain's medium-term growth prospects, especially as we see actions needed on fiscal issues and labor markets," Barclays bank said in a note.

"In addition, a minority government may not be able to sustain a full four-year mandate."

A third election, now or in a few months time, would also likely further alienate voters already scarred by years of economic hardship and unimpressed with leaders' failure to forge coalitions after December, pushing parties to seek a solution.

"They all talk a lot but they don't do anything," said retired fishmonger Rafael Fernandez, 64. He voted for Unidos Podemos in December after years as a loyal Socialist supporter, but this time did not even cast a ballot.

"I feel let down by politics," he said.

(Additional reporting by Paul Day; Editing by Julien Toyer/Mark Heinrich)