The agreement was struck after three days of gruelling negotiations marked by frequent adjournments and late-night sessions and well past a European Union deadline for an agreement.
The EU, which supervised the local elections as part of a mandate to administer Mostar, had threatened to pull out unless the two sides, deeply mistrustful after a 10-month war, reached an agreement. EU officials had set a deadline of Saturday night but backed away from carrying out their threat.
An explosion overnight in Croat-held western Mostar underscored rising tensions between the two communities. A car was damaged and windows in nearby flats were shattered after an explosive device detonated in a garage.
Despite the frequent delays, EU mediators had remained hopeful that the Bosnian Croats would halt their boycott of a newly elected city council.
Bosnian Croats and Muslims fought a bitter war in 1993 and 1994, while the main Muslim-Serb conflict raged in Bosnia. Some of the worst fighting occurred in Mostar.
Diplomats fear that failure to implement the results of the Mostar poll could derail nationwide elections planned for next month and make a mockery of international attempts to overcome hatreds between the Muslim and Bosnian Serb communities.
The Mostar deal is a cornerstone of the Dayton peace accord, which ended the 43-month war in Bosnia. Had no agreement been struck, diplomats feared the ethnic partition of Bosnia would have been imminent and a new war for territory would have been almost certain to break out.
At the heart of the dispute was the refusal of hardline nationalist Croats to accept a slender Muslim victory in local elections held on 20 June for a new ethnically-mixed Mostar council. Croats boycotted the council over a voting irregularity that the EU ruled too minor to affect the result.
Croat nationalists who oppose the proposed unification of the city and are bent on the dream of Greater Croatia want to promote their half of town as the capital of their self-styled state, called Herzeg-Bosnia.