Ovechkin collected his sixth goal in seven games and moved ahead of Mark Rechhi into sole possession of 20th place on the NHL's all-time goals list with 578.
Devante Smith-Pelly, Brett Connolly and Jakub Vrana also scored for the Capitals (16-11-1), who have won five of six and are 2-1-0 on their season-high, five-game homestand.
After losing his first six starts, Grubauer has allowed two goals in winning his last two.
Timo Meier scored for the Sharks (14-10-2), who finished 2-2-0 on their four-game road trip.
Martin Jones made 25 stops in his first career loss to Washington after four wins.
The first period was scoreless until, with 3:11 left, Smith-Pelly deflected John Carlson's shot from the point past Jones.
Ovechkin made it 2-0 at 7:11 of second period. When San Jose defenseman Brent Burns could not corral a pass at his feet from Kevin Labanc at the Washington blue line, Ovechkin scooped up the puck, skated in alone on Jones and beat him with an elevated backhander.
The Sharks halved the deficit when Justin Braun's blast from the blue line rebounded off the end boards to Meier, who shot it past Grubauer at 11:32.
Late in the period with Washington on the power play, Evgeny Kuznetsov, falling down after a hit at the San Jose blue line, pushed the puck to Ovechkin on the left side. Ovechkin fed Connolly and his backhand was in and out so quickly that play continued. When there was finally a stoppage, the play was reviewed and the goal awarded at 19:08.
The goal then survived a challenge by Sharks coach Peter DeBoer, who contended that the Capitals entered the zone offside.
Vrana closed out the scoring with his eighth goal at 11:36 of the third period on a power play.
NOTES: Washington F T.J. Oshie left the game with an upper-body injury late in the second period after a hit by Sharks F Joe Thornton as Oshie was falling near the boards. ... Capitals F Travis Boyd, the team's sixth-round pick in the 2011 draft, made his NHL debut. F Chandler Stephenson (upper body injury) sat out and is day-to-day. ... Washington F Andre Burakovsky (thumb surgery) took part in the morning skate for the first time since his injury. He has missed 19 games. ... San Jose now holds a 25-10-2-1 lead in the all-time series vs. Washington. ... Sharks F Marcus Sorensen, recalled from San Jose of the AHL on Saturday, was on the third line. F Ryan Carpenter was scratched.