The move - carried by 165 votes to one - is seen as an escalation of a power struggle between the president and a hard-line establishment which has turned against him.
It is seen as the latest clash in a political battle that began when Mr Ahmadinejad publicly challenged Iran's supreme leader in April, only to back down. The confrontations appear to be part of a power struggle ahead of parliamentary elections next year and the vote for Mr Ahmadinejad's successor in mid-2013.
MPs were infuriated when Mr Ahmadinejad consolidated a series of ministries, fired the oil minister and named himself as the replacement. The takeover also technically puts Mr Ahmadinejad at the helm of Opec (Organisation of the Petroleum Exporting Countries), since Iran holds the rotating presidency this year.
It's unclear whether the vote in the 290-member parliament will actually be followed by charges against Mr Ahmadinejad, but in any case it pits the president against a majority of MPs, including parliamentary speaker Ali Larijani, a leader of a rival camp within the president's conservative political bloc. If charges proceed, Mr Ahmadinejad could well face an investigation by the judiciary, which is led by Mr Larijani's brother.
Mr Ahmadinejad was re-elected president in 2009 in a disputed vote that sent Iran into its worst internal chaos since the 1979 Islamic Revolution. He has tried unsuccessfully to position a protg to succeed him, but many of his allies, including the Larijani brothers and apparently supreme leader Ayatollah Ali Khamenei, are turning against him in a bid to retain power.
The legislators voted to refer Mr Ahmadinejad to the judiciary after a parliament committee report concluded his takeover of the oil ministry was unconstitutional. Some MPs have already hinted that he may stand to gain financially. Remaining MPs were absent or abstained.
"This illegal and hasty action will damage the Islamic Republic of Iran's interests on the global level," the parliament committee report said. "As (caretaker] oil minister, Ahmadinejad has issued and will continue to issue orders that are obviously illegal interference."Iran's constitutional watchdog, the Guardian Council, has already said Mr Ahmadinejad's takeover was illegal.
But the president has given no sign of backing down other than saying he would not attend an Opec meeting in Vienna next week and would send a minister instead, probably economy minister Shamseddin Hosseini.
About 50 MPs have also signed a petition to summon Mr Ahmadinejad to appear in parliament to answer questions, short of the one-quarter needed to order a president to submit to questioning before the Iranian assembly for the first time since 1979.
Those behind the petition want Mr Ahmadinejad to respond to a long list of accusations, including refusing to carry out laws passed by parliament, withdrawing money from state funds without authorisation and his alleged lack of transparency on budget spending.