Updated

Jason Marquis has been in the majors for more than a decade and still doesn't consider himself a finished product.

Marquis pitched a five-hitter to beat Tim Lincecum, and reserve outfielder Laynce Nix made the most of a rare start by connecting for a two-run homer that carried the Washington Nationals to a 3-0 victory over the San Francisco Giants on Friday night.

"I'm getting more consistent as time goes on. I feel like I'm learning more about myself day-by-day and start-by-start," Marquis said.

Marquis (3-0) struck out seven and walked none in his fourth major league shutout and first since 2009 with Colorado. Always a dangerous hitter, he helped his own cause with an RBI single and is batting .385.

"I was keeping them off-balance, pushing and pulling the string with my fastball and off-speed stuff," he said. "The defense did an unbelievable job for me tonight. I just felt like I had command of all my pitches and was able to throw them on any count."

After signing a $15 million, two-year contract, Marquis was a bust last year in his first season with Washington. Limited to 13 starts because of an arm injury, he went 2-9 with a 6.60 ERA.

This season has been much better. The right-hander threw 96 pitches in his seventh career complete game, dispatching the Giants in a game that took only 2 hours, 9 minutes.

"He was really good. He just made the game feel really comfortable for everyone in our dugout," Nationals manager Jim Riggleman said. "He was extremely sharp. He had everything working. Pitching controls the game, and he was in complete control tonight."

Lincecum (2-3) had seven strikeouts in seven innings to take over the major league lead, but dropped his second consecutive decision.

"I gave them too many good pitches to hit when I got ahead," Lincecum said. "I didn't have any walks, but when you come up with a loss, it's not all that gratifying."

The punchless Giants, blanked for the second time in three games, have lost six of their last eight.

"Hitting's contagious. So is not hitting," manager Bruce Bochy said. "Right now, we've got a serious virus in this lineup."

Making his sixth start of the season, Nix drove a 1-2 breaking ball to right in the second inning for his third homer. It was the second one Lincecum has allowed this year.

"It was my first time facing Tim and I was fortunate to get a pitch over the plate I could handle," said Nix, who barely missed a second homer in the seventh, when his titanic drive off the second deck went just foul. "I didn't try to think too much about who I was facing."

Nix's shot also drove in Wilson Ramos, who was on second with a double thanks to a misplayed fly ball by the Giants. Center fielder Aaron Rowand appeared to have a bead on Ramos' tailing drive, but right fielder Cody Ross collided with him and the ball popped out of Rowand's glove.

In the next inning, Ross led off with a sharp single down the third base line, but was thrown out by a large margin by Nix — the left fielder's first assist of the season.

Ian Desmond led off the fifth inning with a single — one of his three hits on the night — and Marquis, one of the NL's best hitting pitchers, tomahawked a fastball that was nearly over his head into right, driving in Desmond to give Washington a 3-0 lead.

"I figured he might try to go back up there, so I was trying to put the bat on the ball," Marquis said. "If you find a hole, you find a hole."

While the Nationals figure out their offense, it's been solid pitching that has kept them around the .500 mark, something the team's position players are thrilled about.

"It just goes to show our pitching staff is a lot better than what people think," Desmond said.

NOTES: Giants outfielder Andres Torres, on the disabled list since April 15 with a left Achilles' strain, played four innings in an extended spring training game in Arizona and stole a base. ... Miguel Tejada, mired in a 4-for-32 slump entering the game, was bumped up to seventh in the Giants' lineup. "We'll see if we can jump-start him there," Bochy said. ... Washington is the only team with at least five innings pitched in every game from its starters. The Nationals' streak is at 25 straight games.