Socialist leader Pedro Sanchez and the head of new anti-austerity party Podemos, Pablo Iglesias, discussed possible joint initiatives in areas ranging from youth unemployment to the defence of Spain's pension system during a meeting in parliament, the two parties said.
The two formations will form joint working groups on these and other topics, Iglesias told reporters after the meeting.
The main opposition Socialists, and Podemos, the third biggest formation in parliament, aim to form a left-wing block in the assembly to oust Rajoy's Popular Party (PP), which has been hit by a string of corruption scandals.
“My priority is that Mariano Rajoy is no longer the head of the government,” Sanchez said during an interview with private television Sexta.
But he ruled out seeking a vote of no-confidence against the government in the short term, following the failure on June 14th of such a motion presented by Podemos.
Tuesday's meeting was the first between the two men since Sanchez was re-elected Socialist leader by party members on a promise of moving the formation to the left.
He had been ousted as leader of the Socialists in a messy internal rebellion in October 2016 by party heavyweights who opposed his hard line against Rajoy and blamed him for succesive electoral defeats.
An interim party leadership then allowed Rajoy and his PP to form a minority government following two inconclusive general elections, a move Sanchez called a mistake.
Since his return Sanchez has decided that the Socialists will no longer back a planned EU-Canada free trade deal, which Podemos and trade unions fiercely oppose.
The Spanish parliament will vote on the deal on Thursday.
The reconciliation between the Socialists and Podemos puts an end over a year of frosty relations between the two parties.
Podemos, which has made no secret that it aims to surpass the Socialists to become the main leftist force in parliament, voted in May 2016 against allowing Sanchez to form a government because he was allied at the time with a centrist party.