The Congress MP was convicted by the court in Gujarat state for 2019 comments about Prime Minister Narendra Modi's surname at an election rally.
Mr Gandhi, who was present in court for sentencing, remains out of jail on bail for 30 days and will appeal.
His party said he was being targeted for exposing the government's "dark deeds". Elections are due next year.
A Congress spokesman said the ruling was full of "legally unsustainable conclusions" - and vowed its politicians would not be silenced.
The ruling Bharatiya Janata Party (BJP) says due judicial process has been followed in the case, which dates back to the campaign ahead of the last election.
Other opposition politicians and organisations deemed critical of India's government have also faced legal action.
Some have raised questions over Mr Gandhi's status as a member of parliament after the conviction.
A two-year jail term would mean Mr Gandhi would not be able to contest the 2024 general election.
Swipe Up For
More Web Stories