PHOENIX -- Randy Johnson was in vintage form on Sunday afternoon at Chase Field.

After going eight consecutive starts without a win, the Big Unit finally got back in the win column, registering career victory No. 289. He looked nothing like the 44-year-old of recent weeks, as the Diamondbacks (44-45) avoided a sweep, beating the Padres, 3-2.

"I don't care how long you've played in this game, and he's played for a while," D-backs manager Bob Melvin said. "When you have a couple outings that don't go your way even if you do pitch well at times, you're kind of wondering when that next win is going to come."

Johnson (5-7) threw 6 1/3 innings, allowing just one run -- a game-opening homer to former D-back Scott Hairston -- on three hits. He also tacked on 10 strikeouts.

It was the 211th time in Johnson's career he had at least 10 strikeouts. Nolan Ryan, the all-time leader in double-digit strikeout games, had 215 in his career.

"Things were a lot better today," said Johnson, who had been working with pitching coach Bryan Price on his mechanics since his last start, when he allowed seven runs in 3 2/3 innings. "My location was a lot better. My slider was a lot better. I've just got to continue to work and remember what I did today."

The Unit was pulled by Price in the seventh inning after 103 pitches after Kevin Kouzmanoff led off the inning with a double with the D-backs leading, 3-1. Johnson got Chase Headley to ground out to the shortstop, but felt taxed, so Price pulled him from the game.

Johnson was replaced by Chad Qualls, who struck out the following two hitters to end the threat.

"Six innings and 10 strikeouts takes a lot out of you," Johnson said. "I got a little gassed. [Catcher] Robby [Hammock] said my slider was starting to hit the middle of the plate. It was a good time to come out of the game."

Tony Pena pitched a scoreless eighth, and Brandon Lyon, after allowing a run in his first two hitters faced, picked up his 18th save.

D-backs right fielder Justin Upton hit a tape-measure blast leading off the fifth inning. The 20-year-old smacked a high fastball off Padres starter Josh Banks (2-4) 484 feet to left field. It was the second-longest homer recorded at Chase Field. Richie Sexson hit the longest, a 503-foot blast on April 26, 2002.

"It's a good feeling anytime you can hit a home run, but for it to tie the game up and give us a chance to get back in it, it was even bigger," Upton said, adding that he thought it was the longest he's ever hit a ball. "I kind of caught it perfect. At that point, I was just trying to get something started. I just happened to get a pitch I could handle."

"I thought it was going to get all the way up to the back wall when he first hit it," Melvin said. "A guy like that has that type of power and gets into one completely like that, you know it's gone, you just try and take a look to see how far it goes."

For the D-backs, the significance of the win is extra important. Not only was Johnson able to break up of his slump, but the D-backs were able to avoid a sweep at home, as well as maintain a half-game lead over the Dodgers, who also won in San Francisco.

The team has now owned sole possession of first for 81 days, a franchise record. That could change Monday, however. As the D-backs have a travel day to Washington, the Dodgers will be at home against the Braves. A win would put the two teams in a deadlock for first.

For now, the team will have to soak in what it accomplished on Sunday, despite going through a 3-4 homestand. A lot of the postgame praise was aimed directly at Johnson.

"It was a big win for us," Melvin said. "It looked like he had quite a bit of fight in him out there today. I know going into his next outing this will probably help him quite a bit, not only with the win, but the command and the amount of strikeouts. That's kind of the fashion that he's used to pitching."