The 33-year-old last played for India in 2013 during Sachin Tendulkar’s farewell Test against the West Indies in Mumbai. In all, he played 24 Tests between 2009 and 2013 in which he took 113 wickets.
“I am writing this letter to tender my formal retirement from international and first-class cricket with immediate effect,” Ojha said in a statement on his Twitter account.
“To be an Indian cricketer and represent the country at the highest level was always a dream I cherished as a youngster.
“I fall short of words to describe how fortunate I have been to have lived my dream and earned the love and respect of my fellow countrymen,” he added.
From 18 ODIs, he grabbed 21 wickets. He also played six T20 Internationals.
Ojha, who competed for erstwhile Deccan Chargers and Mumbai Indians in the IPL, was once reported for having a suspect action in 2014. He underwent corrective rehabilitation and was cleared in 2015.