Warrington removed the one realistic threat to their place in the Super League play-offs, although they had to survive a frantic last few minutes after their prop, Paul Rauhihi, was sent off for a high tackle.
Five minutes from time, Chad Randall brought Harlequins to within a converted try, and in the time remaining Warrington had a length-of-the-field effort disallowed for obstruction.
"The sending-off was always going to throw some fatigue into our ranks," said the Warrington coach, Paul Cullen. "It wasn't the prettiest game of rugby league I've been associated with but it was a very important win."
Warrington got a dream start when Brent Grose intercepted a speculative pass from Henry Paul. Although Nick Bradley-Qalilawa caught him before the try-line, Chris Bridge was in support to take the scoring pass. Inside the opening eight minutes, the Wolves were in double figures, Henry Fa'afili touching down in the corner.
Five minutes before half-time, Lee Briers sent Logan Swann through a gap with Andy Bracek in support to score after a spot of juggling, and Warrington were moving out of sight.
A torrential second-half downpour did not help the quality of the game, but Harlequins struck first after the interval with Bradley-Qalilawa going over. A penalty conceded by Paul Sykes for dissent helped Warrington repair the damage quickly, Martin Gleeson selling a dummy and going in with ease.
A pass from the player signed from Warrington on loan, Paul Noon, put Bradley-Qalilawa in for his second before Rauhihi went off for his horribly mistimed tackle on Daniel Heckenberg. It made it all a lot more nervous than it should have been but Warrington's top-six place now looks assured.
Warrington: Reardon, Fa'afili, Martin Gleeson, Kohe-Love, Grose, Briers, Bridge, Leikvoll, Sullivan, Rauhihi, Swan, Wainwright, Westwood. Substitutes used: Mark Gleeson, Wood, Barnett, Bracek.
Harlequins: Sykes, Stewart, Smith, Gafa, Bradley-Qalilawa, Paul, Dorn, Heckenberg, Randall, Mills, Hopkins, Noone, Purdham. Substitutes used: Budworth, Haumono, Williams, Tookey.
Referee: S Ganson (St Helens).