Congress' Ashaben Patel wrested the seat, falling in the Patidar-dominated Mehsana district, from BJP's five-term MLA Narayanbhai Patel.
Mehsana was the epicentre of the Patidar agitation, which flared up in 2015.
Also Read
Ashaben defeated Narayanbhai by a margin of 19,529 votes. She bagged 81,797 votes as against the BJP candidate's 62,268 votes.
The 79-year-old BJP veteran had defeated Ashaben, 40, in the 2012 assembly election, winning the seat by a margin of over 24,000 votes.
Out of the total 2.12 lakh voters of Unjha, over 77,000 are Patidars, while around 50,000 belong to the Thakor community.
Both Modi and Congress president Rahul Gandhi had held poll rallies in Vadnagar.
Overall, in the Mehsana district, BJP won five of the seven seats, with two going to the Congress.
Apart from Unjha, Congress bagged the Becharaji constituency while the Mahesana city, Kheralu, Visnagar, Kadi and Vijapur seats went to the BJP.