The left-back powered the ball into the top corner amid some early pressure and the home side repelled Motherwell’s comeback attempts to end the SPL’s only unbeaten away record.
Motherwell had some good possession and midfielder Nicky Law had a header cleared off the line but Hearts were never under the cosh and substitute John Sutton squandered a chance to make the game safe.
Both teams lined up with similar formations with Tom Hateley at the base of a three-man central midfield for the visitors, who brought in Fraser Kerr for the suspended Adam Cummins.
Motherwell had not played for three weeks due to their game against Dundee United before the international break fell victim to a power cut, but they showed no signs of initial rustiness as winger Jamie Murphy threatened inside 45 seconds with a run and shot that Jamie MacDonald pushed wide at full stretch.
But Hearts quickly forced their way on the front foot and Andrew Driver curled just wide from 20 yards before they took the lead after 14 minutes. A quick free-kick 10 yards inside the Motherwell half found its way to Grainger, who was allowed to run forward and unleash a powerful 25-yard strike into the top corner.
Hearts soon had another chance when Arvydas Novikovas crossed for Ryan Stevenson but Hateley threw himself in the way of the midfielder’s header to block.
Motherwell rediscovered their attacking game midway through the half with the catalyst a good piece of skill from Chris Humphrey that took him past Grainger.
The winger found Keith Lasley in the box but the Motherwell skipper was off balance as he shot wide.
MacDonald soon got down well to hold Murphy’s curling effort from 22 yards and Humphrey came inside and shot just wide from similar range.
Hearts were sitting deep but lone striker Callum Paterson managed to get a shot on target from outside the box with Darren Randolph equal to it.
Motherwell suffered a major blow as the 45 minutes elapsed when centre-back Shaun Hutchinson went off with what appeared to be a hamstring injury. Kerr moved inside and Hateley returned to right-back with Stuart Carswell having to wait until after the interval to come on in midfield.
Motherwell created a good chance just after the restart as Law’s diagonal ball found Humphrey and he drove into the box before squaring for Michael Higdon, who fired just wide from 12 yards.
Stevenson, who turned down a move to Motherwell before rejoining Hearts in August, just missed the top corner on a Hearts break and Motherwell almost benefited themselves from a counter-attack but Higdon shot straight at MacDonald from 18 yards after Humphrey had dispossessed Grainger.
Hearts brought on Sutton for Novikovas with Paterson moving wide, and the former Motherwell striker missed a great chance midway through the half when he headed wide from six yards after Driver had nodded a half-cleared corner back into the goalmouth.
The home side were by no means in control but were comfortable enough and Stuart McCall made a tactical change with 16 minutes left with Henrik Ojamaa coming on for Murphy and joining Higdon up front.
They immediately created a chance when Higdon headed Humphrey’s cross into the path of Law but his header was cleared off the line by Andy Webster. But Motherwell could not sustain the pressure and their hopes died when Hearts cleared an injury-time corner after Randolph had joined his team-mates in attack.