"I was getting a little stagnant out there," he said. "It's one of those things where it's mind over matter. You've just got to fight and keep that desire going."
Alvarez played a big role in ending the marathon with his 23rd homer of the season. The drive broke a 3-3 tie as the Pirates won the longest game in the majors this season.
It took 6 hours, 7 minutes to finish, trying the longest contest by time, matching a game between Baltimore and Boston on May 6.
Both teams scored a run in the 17th, and each club used eight pitchers.
Wandy Rodriguez (8-12), who was set to start for the Pirates on Monday night at San Diego, got the win with two scoreless innings of relief. It was his first win as a reliever in 232 major league appearances.
"That was a backyard tug-of-war," Pittsburgh manager Clint Hurdle said. "We kept playing defense, we kept pitching. At the end of the day, we finally got some separation in the 19th inning.
About 9,000 fans from the original crowd of 43,412 stayed until the end.
Each team had played a marathon in recent years. St. Louis went 20 innings against the Mets on April 17, 2010, and Pittsburgh played 19 innings at Atlanta on July 26, 2011.
The Pirates improved to 4-0 in extra innings this season. They moved two games ahead of St. Louis in the race for the last wild card spot in the NL. The Cardinals have lost three of four overall.
"It was a battle all around on both sides," McCutchen said. "They came to play and we were just able to get the win.
It feels good."
Alvarez picked on a slider from Browning and drove it 408 feet.
"It felt good out of my hand," Browning said. "It just stayed up. It don't think I've ever been this disappointed. I just didn't do my job."
Both teams ran out of position players after the 18th inning.
"It was just luck," McDonald said. "You know how hard pinch hitting is? So it was pretty much luck."
St. Louis left-hander Jaime Garcia, sidelined for 64 days with a strain in his pitching shoulder, struck out a career-high 10 and did not allow an earned run in an eight-inning, 107-pitch stint. He gave up five hits, two unearned runs and did not walk a batter.
Carlos Beltran put St. Louis in front with a two-run double in the fourth, and also stole three bases, tying a career high. Beltran leads the NL with 85 RBIs.
"Twenty innings or nine innings, a loss is a loss," Beltran said. "We had the opportunities. It just didn't happen."
Pittsburgh starter Jeff Karstens gave up two runs and two hits over seven innings. He struck four and walked one.
The Pirates scored twice in the sixth to tie it on a pair of infield singles and Garcia's throwing error. Clint Barmes reached on an infield hit and Garcia mishandled a bunt attempt by Karstens. Josh Harrison drove in Barmes with a sacrifice fly and McCutchen followed with an infield single.
Hurdle said he has yet to select a starting pitcher to replace Rodriguez on Monday.
"I'll come up with something tomorrow," he said.
St. Louis 1B Allen Craig extended his hitting streak to nine games with a single in the fourth inning. ... Jon Jay snapped an 0-for-14 skid with a two-out single in the 13th. ... Garcia's 10 strikeouts are the most by a St. Louis left-hander since Mark Mulder had 12 on May 9, 2005, against Los Angeles. ... The Cardinals sent RHP Trevor Rosenthal to Triple-A Memphis prior to the game to make room for Garcia. ... St. Louis plays host to Houston in a three-game set beginning Tuesday. Adam Wainwright (11-10, 3.87) will face Lucas Harrell (10-8, 3.81) in the series opener. Wainwright drew a walk as a pinch hitter Sunday. ... Pittsburgh closes out a six-game road trip with three at San Diego starting Monday. ... Walker did not start for the fourth successive game with a dislocated pinky on his right hand. He later pinch hit. ... Molina grounded out to second to finish a 14-pitch at-bat in the fourth.
Blackmon clears the bases, Murphy knocks in 4th run of inning
Charlie Blackmon clears the bases with a double to deep right field and Daniel Murphy adds on to the Rockies' 4-run fourth inning with a single to left in Colorado's win over Seattle.
Sources: Cardinals vs. Pirates on Monday postponed due to coronavirus
The Pirates won't fly to St. Louis on Sunday and their scheduled game against the Cardinals on Monday has been postponed, sources told ESPN's Jeff Passan on Saturday. Nine Cardinals players and seven staffers have tested positive for the coronavirus.
Padres activate Eric Hosmer from IL, option Abraham Almonte
San Diego Padres first baseman Eric Hosmer was activated from the injured list Saturday after missing 11 of the first 14 games with gastritis. He said he never received a precise diagnosis of the ailment.
Yankees' Giancarlo Stanton to have MRI on injured hamstring
Giancarlo Stanton will have an MRI on his hamstring, and manager Aaron Boone said "it does look like it's an IL situation" for the Yankees slugger.
Gerrit Cole fails to win 20th regular-season game in row as Yankees, Rays split doubleheader
Gerrit Cole, who had won his first three starts for the Yankees this season, struck out 10 and walked one in a no-decision Saturday, as the Yankees defeated the Rays to open a doubleheader.
Tigers hit 4 homers on game's first 11 pitches in rout of Pirates
Niko Goodrum, Miguel Cabrera, C.J. Cron and Jeimer Candelario all hit home runs in the first inning against Pittsburgh's Derek Holland as the Detroit Tigers drilled the Pirates 11-5 on Saturday.