BRUSSELS—Greece struck a tenuous agreement for a four-month extension of its bailout Friday, removing immediate concerns over a potential exit from Europe’s currency union but setting the stage for more tense negotiations over the country’s financial future.

The deal, reached after weeks of often harsh exchanges between Athens and other European capitals, forced the left-wing government of Prime Minister Alexis Tsipras to temper many of the anti-austerity pledges that swept it into power last month.

...