He also congratulated the Election Commission for conducting the polls in a "spectacular manner" and raising the prestige of India's democracy in the whole world.
He said the voters of Gujarat, Himachal Pradesh and Delhi celebrated "the festival of democracy" with great enthusiasm.
The Assembly elections in Himachal Pradesh were held last month and the municipal polls in Delhi took place on Sunday.
"For the celebration of democracy, I heartily congratulate the citizens of the country and greet them. I also heartily congratulate the Election Commission. It has developed a great tradition of conducting elections in a very spectacular manner, increasing the prestige of India's democracy in the whole world," Modi told reporters after casting his vote at a polling station in Ranip area of Ahmedabad city.
He also heartily thanked the voters of Gujarat, saying they celebrated the festival of democracy with great enthusiasm and held discussions in an excellent manner.
"The people of Gujarat are discreet. They listen to everyone and it is their nature to accept what is true. And according to that nature, they are also voting in large numbers. I am also very thankful to the voters of Gujarat," he said.
Modi arrived at the polling station at Nishan High School in Ranip locality of Ahmedabad city at around 9.30 am to exercise his democratic right.
He stood in a queue for a while to cast his vote.
After emerging from the polling station, the PM showed his inked finger to the crowd gathered to welcome him.
He then walked to the house of his elder brother Soma Modi near the polling station.
In the morning, Modi in a tweet appealed to people, particularly the young and women voters, to come in large numbers to exercise their franchise.
He also urged those voting in the bypolls being held in different parts of the country "to turnout in large numbers and vote."
Voting began at 8 am for the second phase of the Gujarat Assembly polls in 93 seats across the state's central and north regions comprising 14 districts.
The first phase of elections were held on December 1 in 89 seats in the state's south and Saurashtra-Kutch regions.
The counting of votes for all the 182 Assembly seats in the state will be held on December 8.
For the second phase of the Gujarat polls, a total of 833 candidates from 61 political parties, including Chief Minister Bhupendra Patel of the Bharatiya Janata Party (BJP), are in the fray in the 93 Assembly segments spread across Ahmedabad, Vadodara, Gandhinagar and other districts. PTI