The triumph continued the winning start to new manager Louis van Gaal's tenure, which opened with a 7-0 trouncing of the Los Angeles Galaxy in the opening match of United's North American pre-season tour on Wednesday.
The going was tougher against the Serie A side, but while Roma was in control early in the first half it was Rooney who opened the scoring in the 36th minute, taking a pass from Mata 25 yards out, turning and firing into the top corner of the net.
Miralem Pjanic pulled one back for Roma in spectacular style in the 75th, unleashing a lob from his own half that arched over helpless United substitute keeper Ben Amos.
Francesco Totti converted a penalty in the 89th to make for an action-filled finish.
More From This Section
The 3-4-1-2 formation implemented by van Gaal was again effective and United played with energy despite the heat and high altitude.
"It's obviously nice to get 45 minutes again under my belt and it's always nice to score, so I was pleased with that," Rooney said. "But the most important thing for us is getting our fitness in ... There's obviously things we could do better, but overall we have to be happy with the win."
The collection of pre-season matches features eight European clubs all preparing for the start of their domestic campaigns.
In Berkeley, California, Inter Milan's Argentine striker Mauro Icardi cancelled out Gareth Bale's rocket with a penalty and then netted the decisive spot-kick in a 3-2 shootout success after Inter had drawn 1-1 with Real Madrid in their International Champions Cup clash.