The victory provided McNamara with the perfect start to his tenure after replacing Peter Houston at the helm in midweek.
Johnny Russell struck after just 16 seconds before Jon Daly doubled the advantage and Russell put the gloss on the victory, which saw Kal Naismith and Ian Black dismissed late on for Rangers.
McNamara said: "It was a great start to the game and I thought we carried a real threat and could have had a few more goals. We are delighted just to get through.
"We've got some good players in the dressing room and you can see the threat we carry throughout the team.
"I was also delighted to keep a clean sheet for the first time in nine games.
"I know what's there and, looking at the team beforehand, I thought they were underachieving a little bit.
"It was the first home win since August. We know there is potential there and hopefully the players get a massive lift."
- Sports & Recreation
- Johnny Russell
- Kal Naismith