ST. LOUIS -- Chad Gaudin found himself in an unfamiliar position Sunday afternoon.

The San Francisco right-hander took the mound to start a game for the first time in over three years and tossed six strong innings to lead the Giants to a 4-2 win over the St. Louis Cardinals, ending the Giants' seven-game road skid.

Brandon Belt hit a two-run pinch-hit double to break a 2-2 tie in the seventh. Buster Posey, who entered the game in a 2 for 20 skid, went 4 for 4 with two doubles to pace an 11-hit attack.

Gaudin (1-1), in his first start since Sept. 28, 2009 as a member of the New York Yankees, allowed four hits and two runs, both coming on David Freese's homer in the fourth. He struck out five and did not walk a batter. Gaudin, who set the side down in order in four of six innings, is temporarily replacing Ryan Vogelsong in the rotation. Vogelsong broke several bones in his right hand May 20.

"It was nice," Gaudin said of the starting assignment, "I made a couple of minor league starts, but it was refreshing to get back out there and do that."

San Francisco manager Bruce Bochy said Gaudin's performance came at a perfect time for his beleaguered staff.

"He gave us a huge shot in the arm," he said. "He went out there and threw quality strikes and actually went a little further than we ever thought."

Bochy said before the game that he was hoping to get four, maybe five innings from Gaudin.

Instead, Gaudin rolled through six on 79 pitches, 55 strikes. In his first start after 117 successive relief appearances, Gaudin earned his first win since Oct. 2, 2012 when he was a reliever with the Miami Marlins.

"I wanted to go out there and give the team a chance to win and also give them some innings," Gaudin said. "I thought I was throwing aggressively and pitching with what I had."

The Giants offense, which had scored just seven runs in its previous six road games, gave Gaudin enough offensive support.

Closer Sergio Romo recorded four outs for his 15th save in 17 opportunities. He got Freese to ground out with Allen Craig on first to end the game.

San Francisco scored single runs in the second and third off Lyons. Posey and Hunter Pence hit back-to-back doubles in the third.

"I hit a couple balls hard that found a couple of holes," Posey said. "So now, it's just a matter of keeping on."

Posey raised his average 15 points to .308 with the four-hit effort.

Freese tied the game with his third homer of the season. He has hit safely in a career-tying 12 successive games.

"I'm seeing the baseball and trying to consistently hit the ball hard somewhere," he said. "It's all about the approach at the plate."

Lyons allowed four runs and eight hits in 6 2/3 innings in his third start. He allowed one run over seven innings in winning his two previous starts.

"I was inconsistent from the beginning," Lyons said. "I was fighting myself, just trying my best to eat up a few innings."

Despite the victory, the Giants have dropped six of their last eight..

"A much-needed win after yesterday," Bochy said.

St. Louis beat the Giants 8-0 and 7-1 in a day-night doubleheader on Saturday.

St. Louis manager Mike Matheny and catcher Yadier Molina were ejected in the third inning by first base umpire Clint Fagan after Molina was called out on a close play at first. Molina slammed his helmet to the ground after the call and was immediately thrown out for the third time in his career. Matheny came out to protect Molina and was ejected for the third time as a manager.

"I know I was out," Molina said. "I was just upset with myself."

Game notes
St. Louis has used eight pitchers age 25 and younger this season including Lyons, 25. .... The Cardinals host Arizona in a four-game series beginning Monday. Lance Lynn (7-1, 2.91) will face Trevor Cahill (3-5, 2.88). The Giants have an off day Monday before hosting Toronto in a two-game set starting Tuesday. Tim Lincecum (3-5, 5.12) goes against Josh Johnson (0-1, 6.86). San Francisco OF Angel Pagan missed his eighth successive game with a strained left hamstring. ... Giants IF Pablo Sandoval, who last played on Thursday, could be out as much as a week with a strain in his left foot. ... St. Louis OF Jon Jay broke out of a 1-for-27 skid with a third-inning single. ... St. Louis INF Matt Carpenter extended his hitting streak to 11 games with a single in the third inning.