It came a day late and only after further discussions were curtailed by a blocking vote.
The conference in Durban, South Africa, adopted two documents - a declaration of principles and an action plan to combat discrimination which the 160 or so states attending agreed to implement.
But some observers asked whether the final documents were worth the trouble stirred up by the conference.
The way was cleared for an accord after the conference voted against Syrian demands to include language implicitly accusing Israel of racism.
Canada, Australia, Syria, Iran and others were deeply unhappy with the declaration's final text on the Middle East conflict - but for different reasons.
For Australia, "far too much of the time at the conference was consumed by bitter divisive exchanges on issues which have done nothing to advance the cause of combating racism".
Iran, for its part. continued to insist that Israel was a racist state: "We should not forget racial practices are made in the occupied Palestinian and Arab territories."
'More harm than good'
"We have not been deterred from making a breakthrough here in Durban," UN Human Rights Commissioner Mary Robinson said in a closing speech to the conference, the largest ever held on racism.
She said it would resonate around the world, especially in communities which still bear the scars of slavery.
She warned that the conference would only be measured by its impact on the victims of racism.
But, as the BBC's Barnaby Phillips reports, the more lasting impression of the conference may be one of deep disarray.
At one point, the proceedings almost descended into farce as stewards frantically searched for remaining interpreters.
"Many delegates are leaving Durban with mixed emotions fearing the divisions exposed here may have done more harm than good," he said.
Apology
The conference began on 31 August and had been due to end on Friday.
The two main obstacles to agreement, the Middle East and the legacy of slavery, kept delegates up negotiating on the text throughout the night.
European countries agreed to apologise for slavery as a "crime against humanity".
They, along with America, had been keen to make sure that the wording would not make them liable for reparations.
EU spokesman Koen Vervaeke, said: "In the way it's drafted now, there can't be any legal consequences."
However, a package of economic assistance to Africa was reportedly also agreed.
The US and Israel walked out of the conference earlier in the week in protest against Arab attempts to adopt a resolution equating Zionism - the political movement supporting the existence of a Jewish state - with racism.