The 53-year-old hardliner took the oath and vowed to uphold the constitution and make foreign policy "stronger and with more effective new plans," quoted the Associated Press.
"I hereby swear by the almighty God to protect the system of the Islamic Revolution and the constitution, I will spare no effort to safeguard the frontiers of Iran," he said. He urged unity, saying, "We should join hands as we move forward to fulfill our goals."
Ahmadinejad did not directly address the massive street protests against his election win, but said his government would "resist any violation of law and interference."
"We will not remain silent, we will not tolerate disrespect, interference and insults," he said, according to the AP.
His opponents say his landslide re-election on June 12 was fraudulent, but the Guardian Council determined in an investigation that there was no major fraud. Opposition leaders and moderate lawmakers boycotted the swearing in ceremony.
Hundreds of policemen were deployed around the parliament while a subway station nearby was closed to the public. At least 30 demonstrators have been killed in the uprising, according to the authorities.
The official IRNA news agency said there was no "disturbance of the peace" on major streets and roundabouts in the Iranian capital during the inauguration but eyewitnesses said at least 10 people were detained by police.
Security forces also dispersed hundreds of protesters who chanted "death to the dictator" in nearby streets, according to the eyewitnesses. Authorities have banned media from covering the street protests, forcing them to rely on eyewitness accounts.
The eyewitnesses said the detained included protesters who wore black T-shirts in a sign of grief over Ahmadinejad's inauguration and a young man wore green slacks, the color of those who support opposition candidate Mir Hossein Mousavi, Reuters reported.
On Monday, Iran's Supreme Leader Ayatollah Ali Khamenei officially endorsed Ahmadinejad's presidency. Under the constitution, Ahmadinejad has two weeks to draft a Cabinet for approval in parliament.
U.S. President Barack Obama and the leaders of France, Britain, Italy and Germany have all decided not to congratulate Ahmadinejad on his re-election, although the White House acknowledged that Ahmadinejad was Iran's "elected leader."
"We heard that some of the Western leaders had decided to recognize but not congratulate the new government," Ahmadinejad responded, according to Reuters. "Well, no one in Iran is waiting for your messages."
Iran and the United States are at odds over Tehran's nuclear program. The United States and its allies believe the program is geared toward developing an atomic bomb, while Tehran says it is for civilian energy purposes only.
"There is a sense that if we continue to let Iran enrich uranium and pursue its nuclear ambitions without any further efforts to stop it, that Iran will be within range of a nuclear weapon with the next year," said Suzanne Maloney, a senior fellow at the Saban Center for Middle East Policy at the Brookings Institution.
Even if the Obama administration were successful in bringing Iran to the negotiating table regarding its nuclear program, the credibility of any subsequent agreements would be in question due to Iran's own political problems, she said.
Maloney explains more in this audio interview:
---- Compiled from wire reports and other media sources