The deal, struck Saturday, plugs a gap in world trade law and allows poorer countries unable to manufacture medicines domestically to override international patents and import cheap generic drugs when they need to.
But health activists immediately attacked the accord, hammered out by the United States, Brazil, India, Kenya and South Africa, saying it imposed too many conditions on countries seeking to use it.
"Today's WTO agreement that is ostensibly intended to get drugs to the poorest countries does not provide a workable solution," Medicines sans Frontieres (MSF, Doctors without Borders) and Oxfam said in a joint statement.
But WTO members were keen to talk up their deal.
"The decision that you have just taken is an historic agreement for the WTO," WTO Director-General Supachai Panitchpakdi told member states.
The EU was also quick to welcome Saturday's decision, which came after days of emotionally charged debate.
"This deal may have taken too many months to complete but finally it shows the WTO can respond flexibly and pragmatically to the concerns of developing countries," European Trade Commissioner Pascal Lamy said in a statement.
The accord, given a final seal of approval by the WTO's 146-member executive General Council on Saturday, means setting aside patents owned by multinational firms that are protected by trade rules.
"I find a special satisfaction in the fact that the decision will be of particular value to the smaller and poorer countries... in Africa and elsewhere," Supachai said.
"It will enable them to make full use of the flexibilities in the WTO intellectual property rules in order to deal with the diseases that ravage their peoples."
Health activists attacked the accord, saying it imposed too many conditions on countries seeking to use it.
An impassioned plea on Friday by African states, who said that thousands were dying as trade envoys bickered, got the talks back on track after a deal agreed on Thursday by the main negotiating body on medicines ran into last-minute problems.
The pact aims to allay US concerns that any waiving of patents could be abused for commercial gain by generic producers such as Brazil and India.
The United States, home to many major pharmaceutical firms, had feared they could turn out highly profitable life-style remedies such as Viagra for sale in richer developing nations.
The drugs industry has welcomed the pact as balancing the need for poor states to fight health problems with the demands that WTO members waive patents only to import generic medicines "in good faith" and do not abuse the system for commercial gain.
Steps will be taken to ensure drugs sold to poor countries do not turn up on rich country markets, and a number of richer developing countries - such as Mexico and South Korea - will agree to use the system only in dire health emergencies.
Existing world trade rules allowed countries - developed or developing - with their own drugs industry to waive patents and issue compulsory licences to generic manufacturers when they face health emergencies.
But the regulations said nothing about states without their own drugs industry and WTO states have been battling over the issue for nearly two years.
A deal before a trade meeting in the Mexican resort of Cancun in less than two weeks was seen as vital to giving new momentum to the WTO's struggling Doha Round of free trade talks.