The Pirates won their fourth one-run game in eight tries this season. A bloop single from Neil Walker to right-center field with two outs in the eighth inning provided the go-ahead run.

Clint Barmes scored from second base on the third of three straight singles with two out, the last of those by Walker off reliever David Hernandez.

"As many games as we played last year, one run, I know that there's a different feel," Walker said. "There was a little more anxiety than there is now. You can tell our nerves are way more calm than last year. One-run games in the big leagues? That's big time."

The Pirates ended a West Coast road trip with three wins in their final four games after an 0-5 start, and won a series in Arizona for the first time since 2005.

Walker admitted he broke his bat on the hit.

"That is kind of sweet retribution for all the balls you hit hard that have been caught," he said.

Walker entered the game with a .243 batting average and hit into two double plays Wednesday. Teammate Pedro Alvarez was thrilled, if not relieved, to record his second hit of the season -- and second home run -- in 27 at-bats.

Alvarez homered in the seventh on a 2-0 pitch from Daniel Hudson (1-1) to tie it at 1.

"Just glad I was able to put a good piece on it. Good things happen when you make good contact," Alvarez said. He raised his batting average 32 points to .074.

Chris Resop and Tony Watson combined to pitch a scoreless eighth inning, and Juan Cruz earned his second save in as many games for the Pirates, who were without closer Joel Hanrahan due to a strained hamstring that forced him out of the past three games.

Hudson pitched 7 2/3 innings but got the loss because he'd allowed Barmes to reach base. He allowed two runs on six hits and struck out five.

"I was able to make a couple of pitches early on," Hudson said. "Late in the game I couldn't get that third out. Another thing I have to go through, I have to push through and get batters out."

The Diamondbacks went ahead 1-0 after leadoff man Willie Bloomquist tripled and scored on Jason Kubel's single in the first. It was the 10th game in 12 overall in which Arizona has scored in the opening inning.

Brad Lincoln (1-0), making his first major league appearance of the season after being called up earlier in the day, relieved McDonald and tossed three shutout innings, striking out four. He escaped a jam in the sixth with a double play with runners on first and third.

Pirates manager Clint Hurdle said he was concerned that McDonald threw 33 pitches in the first inning, and decided to get him out of the game for a pinch hitter in the top of the fifth.

Lincoln earned the win after not sleeping the night before. He flew into Phoenix from Indianapolis in the wee hours of the morning.

"Keep working hard, and good things will happen," Lincoln said. "There's always that opportunity and you've just got to be ready for it."

Game notes

The Pirates placed RHP Jeff Karstens on the 15-day disabled list before the game because of right shoulder inflammation. The club recalled Lincoln from Triple-A Indianapolis, where he was 1-0 with a 2.25 ERA in 12 innings. ... Karstens (0-1 in three games) started Tuesday's game but left after one inning. ... Pirates RHP A.J. Burnett (orbital bone surgery) is expected to make a fourth rehabilitation start Saturday with Double-A Altoona. ... All five of the Diamondbacks' losses this season have been by a single run. ... Hudson's loss was the first for a Diamondbacks starting pitcher this season. ... Arizona OF Justin Upton was used as a pinch runner in the ninth, though he is unable to hit due to a left thumb injury.