TMC candidate Shyam Sundar Sharma defeated his nearest rival Yogesh Chaudhary of RLD 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 people and pledged to work for the development of his constituency.
The by-election was necessitated following resignation of sitting MLA and RLD national general secretary Jayant Chaudhary, who had decided to retain Mathura seat as an MP.