In announcing the move on Wednesday, Purnomo Yusgiantoro, the Indonesian energy minister, said the government was going to focus on increasing domestic production because "we are a consuming country".
"We are not happy with the high oil price," he said, adding that the country will remain a member until the end of the year.
The decision comes just days after the government slashed fuel subsidies that have long protected the poor, forcing prices at the pump to jump by nearly 30 per cent and sparking protests.
Purnomo said the long-term policy was to eliminate subsidies because they undermine market forces and encourage smuggling to other countries.
Having heavily subsidised fuel for decades, Indonesia is now facing a deficit caused by soaring global oil prices now hovering at around $130 a barrel.
The decision to cut subsidies that keep petrol, diesel fuel and kerosene affordable to millions of poor Indonesians risks triggering more protests and political opposition from parties jockeying for position ahead of elections next year.
The government last raised prices in 2005, defying protests and winning praise from international donors.
To cushion the blow, it provided direct cash payments to the poor.
After last week's hike, Indonesians now pay 74 cents per litre of petrol.
Victor Shum, an energy analyst with Purvin & Gertz in Singapore, told The Associated Press that pulling out of Opec would save Jakarta the $3.1m annual fee but cost it some prestige on the international scene.
Indonesia's former Opec secretary-general, Subroto, warned that there was "no benefit" to leaving the 13-member body and it would strip Indonesia of its ability to influence global oil prices in times of crisis.
"If we remain in Opec there is some obligation from other members, if problems arise, to assist us," he said.