United kept up their recent run of fine results to see off spirited visitors and McNamara gave his players full credit.
McNamara said: "I didn't think we were at our best but we still won.
"We said at half-time to keep our shape and discipline and we would get chances. That's how it turned out and we're delighted with the result in the end.
"It was more like a cup tie with tackles flying in which made it hard to get our momentum going.
"However, once we did we showed what we are capable of and got the goals we deserved."
McNamara singled out Brian Graham who netted with a header early in the second half, believing his patience is paying off following his summer move from Raith Rovers.
Stuart Armstrong, Gary Mackay-Steven and John Rankin also netted for United, with a penalty from Jamie Hamill the only reward for Hearts' efforts.
McNamara said: "I'm pleased for Brian Graham. He is getting his rewards.
"He's had to be patient but is a confident player by nature which always helps. He took his header well and is always looking to get on the end of things."
Hearts manager Gary Locke was not too dejected after seeing his side hold their own for long spells of the match before caving in late on.
Locke said: "I thought we played well in the first half and were very much in the game.
"I've got to watch what I say but they got a free header inside the box for their second goal which was a vital moment.
"It was disappointing because Callum Paterson felt their player got a hold of his jersey before scoring.
"It was a decision which has gone against us."
The Tynecastle side were crushed 7-0 by Celtic in the Scottish Cup last week but Locke was satisfied with their efforts this time.
He said: "We were well-organised and battled hard. We didn't let our heads go down.
"Dundee United are a really good side and they are in sparkling form right now. But we can take the positives out of this game and there were quite a few.
"It was a heavy defeat against Celtic the week before but we showed good mentality and character.
"I know 4-1 looks like we've taken another hammering but that's not the case. We went for it at 2-1 to try to get an equaliser but we got caught and Gary Mackay-Steven hit a wonderful effort to make to make it 3-1."