TMC candidate Shyam Sundar Sharma defeated his nearest rival Yogesh Chaudhary of the Rashtriya Lok Dal by 6,604 votes.
Sharma was declared winner by returning officer Manoj Kumar after getting a total of 67,457 votes against Chaudhary, who got 60,853 votes.
Samajwadi Party candidate Sanjay Lathar stood third by grabbing 50,039 votes.
Mat constituency falls in Mathura district of the state.
Sharma, who had lost in the recently-concluded assembly polls, termed it as a victory of the people and pledged to work for the development of his constituency.
The by-election was necessitated following the resignation of sitting legislator and RLD national general secretary Jayant Chaudhary, who had decided to retain Mathura seat as a member of Parliament.