For the second time this week, Spanish lawmakers on Friday rejected a bid by Mariano Rajoy, the caretaker prime minister, to form a government, increasing the likelihood that Spain will have to hold its third national election in a year to break its political stalemate.

Lawmakers turned down Mr. Rajoy’s proposed government by a vote of 180 to 170, the same result as a vote on Wednesday.

Friday’s vote followed another acrimonious debate during which party leaders sought to highlight their differences rather than offer any new concessions.

Mr. Rajoy’s attempt to form a government was scuttled by the votes of the main left-wing opposition parties, led by the Socialists.