Greek Prime Minister Alexis Tsipras barely survived a no-confidence vote in parliament Wednesday, 151 to 148.
"I call upon you with hand on heart to give a vote of confidence today to the government which gave battle, which bled, but managed to haul the country out of memorandums and surveillance," Tsipras asked the lawmakers before the vote.
He was apparently referring to the economic bailouts Greece needed over the past decade to avoid bankruptcy and economic ruin.
Tsipras himself called for the no-confidence vote after Defense Minister Panos Kammenos resigned and pulled his nationalist ANEL Party from the ruling coalition.
Kammenos quit to protest the U.N.-brokered deal with Macedonia, ending a nearly 30-year-long dispute over who gets to use the name Macedonia.
If approved by the Greek parliament, the former Yugoslav republic would be officially called the Republic of North Macedonia.
Kammenos appealed to Tsipras Wednesday to put the name change question before voters in a referendum.
Many Greeks, especially nationalists, are upset over the deal. They say the name should exclusively belong to the ancient region of northern Greece, made famous by Alexander the Great.
Opponents say letting the country of Macedonia use it implies territorial claims on the region.
The dispute has held up Macedonia's desires to join NATO and the European Union because of Greek objections.