The last time Giants manager Bruce Bochy was hospitalized for a heart issue, San Francisco needed to survive 14 shaky innings under bench coach Ron Wotus to beat the Miami Marlins.

The Giants only needed 11 tense innings to beat the Kansas City Royals on Tuesday night.

Joe Panik hit an RBI single with two outs in the second extra frame, and San Francisco held on through a few tense moments to beat the Royals 2-1 in their first visit to Kauffman Stadium since its dramatic win in Game 7 of the 2014 World Series.

Bochy watched the game from home after undergoing a minor procedure in San Diego to correct his heart rhythm. Wotus once again filled in with Bochy expected back Friday in Colorado.

"I hope he wasn't watching it," Wotus said. "He has a knack for knowing which games to take off."

Nick Hundley doubled off Scott Alexander (0-1), the Royals' fifth reliever of the night, before Panik's sharp liner dropped in front of center fielder Lorenzo Cain to score the go-ahead run.

Derek Law (1-0) pitched two scoreless innings of relief for San Francisco, and Mark Melancon struck out Raul Mondesi with runners on first and second in the 11th for his third save of the year.

"It's a good team win. Everyone battled tonight," Wotus said. "When you lose those extra-inning games, especially where we've been, it makes it that much tougher the next day."

The Royals had several chances to end the game earlier, leaving the bases loaded in the eighth, two aboard in the ninth and two more on base when Eric Hosmer grounded into a double play in the 10th.

San Francisco also left two runners aboard in the 10th when Buster Posey, fresh off the seven-day concussion list, struck out. Posey already had three hits on the night.

The Giants' Matt Cain and the Royals' Jason Hammel waged a nip-and-tuck duel of starters, each taking advantage of double plays and nifty defense to escape sticky situations.

Cain left two aboard in the first, and also stranded runners in the second and fourth, before he threw a mistake that Whit Merrifield deposited into the right-field seats. Cain walked the next batter, but set down the next seven to leave after seven innings with the game knotted at 1.

"Nick and I did a good job of moving the ball in and out," said Cain, who allowed four hits and two walks while striking out three. "They weren't able to sit on one side of the plate."

Hammel was perfect through four before getting into trouble in the fifth, then allowing Hunter Pence's run-scoring single in the sixth. He got through that inning and allowed the first two batters to reach in the seventh, but relievers Peter Moylan and Travis Wood bailed him out of that fix.

"I was certain we were going to find a way to punch a run across," said Royals manager Ned Yost, whose club had its four-game winning streak snapped. "We went 1 for 11 with runners in scoring position and the one was an infield hit. We just couldn't make it happen."

TRAINER'S ROOM

Royals OF Jorge Soler (left oblique strain) felt some tightness on Saturday and his rehab work was shut down for a couple days. He resumed swinging before Tuesday night's game.

UP NEXT

Royals LHP Jason Vargas tries to continue his hot start. He is 2-0 with a 0.66 ERA in his first two outings, and tossed 7 2/3 scoreless innings against Oakland his last time out.