Mata fired the visitors in front early in the first half, before Gerrard came on at half-time and was immediately dismissed for a stamp on Ander Herrera after the restart.
United doubled their lead on the hour mark with a stunning acrobatic second from Mata before Daniel Sturridge pulled one back, Wayne Rooney then had a penalty saved but Louis van Gaal???s side held on to move within two points of second-placed Manchester City.
It ends a run of 13 games unbeaten for Brendan Rodgers??? men, whose last defeat also came at the hands of United when they lost 3-0 at Old Trafford in December.
The result is also a massive blow to Liverpool???s top-four hopes, as they sit five points behind their conquerors, who currently occupy the fourth Champions League spot.
It was the visitors who came out of the blocks quickest, and they kept the Anfield crowd quiet as they dominated the possession in the opening stages.
Their pressure paid off in the 14th minute as Marouane Fellaini squared to Herrera, and the midfielder found the run of Mata with an excellent ball beyond the defence, before the Spaniard collected his pass and fired it low across Simon Mignolet just inside the post.
Rodgers??? men were looking nervous and the constant United pressure on the ball meant they were often surrendering possession easily. But United couldn???t press home their advantage and, after being outplayed for the first half an hour, the hosts finally found their feet in the game as Lallana spurned a glorious chance to equalise.
Raheem Sterling set Jordan Henderson away down the right flank, and the midfielder fired an excellent early ball around the visitors??? defence for Sturridge. The striker had a chance to shoot but decided to lay off for the late run of Lallana, but his England team-mate could only drill his first-time effort wide of the target from 18 yards out.
That chance brought the crowd into action and Liverpool started to enjoy more time inside the United half, but Van Gaal???s men nearly doubled their lead right before the break as Michael Carrick fired a speculative effort from 25 yards, nearly catching Mignolet out, but the goalkeeper managed to keep it out.
Gerrard was introduced for Adam Lallana at the break as Rodgers looked for some inexperience in midfield, but 38 seconds after coming on the captain was dismissed as he went in for a challenge on Herrera and appeared to stamp down on the United midfielder, prompting a straight red from referee Martin Atkinson.
The hosts initially reacted well to the pressure, and Philippe Coutinho drilled a long-range effort just over the crossbar, but they soon found themselves further behind as Mata grabbed his second in the 59th minute.
The Spaniard squared the ball inside to substitute Angel Di Maria, who returned it with a delightful chipped pass before Mata fired it home with a spectacular acrobatic finish.
Liverpool managed to haul themselves back in it 10 minutes later, however, when Coutinho drove through the middle and found Sturridge, who managed to fire the ball inside the near post aided by a deflection off Phil Jones.
Both sides enjoyed spells of possession as the game twisted and turned, with tempers flaring all over ??? substitute Mario Balotelli possibly lucky to escape a second yellow for an altercation with Chris Smalling after picking up an earlier booking for a challenge on Jones.
The visitors were given the chance to kill the game off in stoppage time when Daley Blind got past Emre Can in the box and went down under the defender???s challenge, but Rooney???s shot to the left was easily parried away by Mignolet.
It wouldn???t affect the result of the match, which ended on a sour note as Martin Skrtel caught De Gea with a late challenge and the two squared up, but United took the victory to end Liverpool???s unbeaten run and move five points clear of their top-four rivals.