|Bath (9) 22|
|Tries: Clark Con: Priestland Pens: Priestland 5|
|Harlequins (7) 12|
|Tries: Visser, Yarde Con: Jackson|
Rhys Priestland kicked 17 points as Bath prevailed in an error-strewn encounter against Harlequins.
A disjointed opening 40 minutes saw Quins winger Tim Visser score the only try while Priestland pushed Bath into their 9-7 half-time lead off the tee.
Harlequins started the second 40 with a try from winger Marland Yarde before Max Clark put the hosts back in front.
Bath's bench added intensity and Priestland's accuracy rewarded his side's endeavour with the victory.
- Relive Saturday's Premiership rugby action
- Read more: James Short hat-trick secures Exeter win at Worcester
- Read more: Leicester run in eight tries against struggling Bristol
Bath were far from their best but victory keeps them inside the top four and four points ahead of fifth-placed Leicester, who made light work of struggling Bristol.
Their pack gained the ascendancy at scrum time in the first half as both sides looked to play with tempo but neither had crisp enough handling.
Eventually Harlequins tidied up their act and Scotland international Visser finished a well-worked overlap to score the first try of the game either side of Priestland's second and third penalties.
The visitors started the second half with purpose and hooker Rob Buchanan charged forwards before making a superb offload out of contact to Yarde to score in the corner.
A missed conversion by Ruaridh Jackson saw the hosts move up a gear and Clark's powerful drive put them back in front. Priestland denied Harlequins a losing bonus-point with two more penalties before the finish.
Bath director or rugby Todd Blackadder:
"It was just one of those games when we felt in control, out of control.
"There were lots of mistakes, and then we showed some real grit in the last 20 minutes to win it.
"The Six Nations period was always going to be a bit like this. We had planned for it to be a little bit messy.
"We have a lot of injuries and it is really hard to build on combinations when you have a load of injuries."
Harlequins director of rugby John Kingston:
"I am gutted. I felt the guys deserved as an absolute minimum a point out of the game, and for them to not come away with that is really hard to take.
"The team had been gathering momentum in the Premiership, so to come away with nothing - particularly in light of the effort the guys put in and how the game was played - was a bit harsh on them.
"There are seven (Premiership) games to go. Four of those are at home, where our record is terrific. You end up where you deserve to be and we will see where that is in May."
Bath: Homer; Rokoduguni, Clark, Jennings, Davies; Priestland, Fotuali'i; Catt, Dunn, Lahiff, Stooke, Ewels, Denton, Louw, Faletau.
Replacements: Batty, Obano, Palma-Newport, Ellis, Grant, Cook, Hastings, Atkins.
Harlequins: Morris; Yarde, Marchant, Hopper, Visser; Jackson, Mulchrone; Evans, Buchanan, A Jones, Reddish, Matthews, J Chisholm, Ward (capt), Luamanu.
Replacements: Gray, Gendall, Shields, Merrick, Naoupu, L Jones, Evans, Alofa.
Referee: Craig Maxwell-Keys.
For the latest rugby union news follow @bbcrugbyunion on Twitter.