"Thank you. Long live democracy!," Modi said.
Gandhi, in a series of tweets earlier on Saturday, congratulated Modi and the Bharatiya Janata Party for their victory in the two state assembly polls.
Gandhi also said the Congress would continue to fight till it won "the hearts and minds of people".
"I congratulate Shri Narendra Modi and the BJP on their victory in Uttar Pradesh and Uttarakhand," Gandhi said.
He also congratulated Punjab Congress chief Captain Amarinder Singh for the party's victory and said it was a mandate for a brighter future of the state.
"My heartiest congratulations to Capt Amarinder Singhji and all our party workers who worked tirelessly @capt_amarinder," Gandhi posted.
In his tweet addressed to party workers, Gandhi said the party stands committed to its values.
"To all Congress workers across India: We stand resolute and committed to our values and our belief in an India united in strength and purpose. Our fight continues and will not end...," he said