During a career that has spanned five decades, Dusty Baker was pressed to remember a baseball game as zany at this one.

"I feel like I just came out of `The Twilight Zone,'" the Nationals' first-year manager said Sunday night after Washington spent nearly six hours crafting a 6-5, 16-inning victory over the Minnesota Twins.

Bryce Harper tied it with a pinch-hit home run in the ninth inning, pitcher Oliver Perez put down a bunt in the 15th that kept the game going and Chris Heisey homered in the 16th to end it.

More from FoxSports

At 5 hours, 56 minutes, it was the longest regular-season game in Nationals' history. By far one of the wildest, too.

"We've seen thousands of games. They always say, go to the ballpark and you may see something you haven't seen before," Baker said. "Well this, I certainly haven't seen anything like this. This was crazy."

Harper was supposed to have a day off, but stepped up to lead off the ninth with Washington trailing 4-3 and connected for the first pinch-hit homer of his career.

"(Baker) came up to me at the beginning of the game and said, if we have an opportunity to pinch hit you, if you can hit a homer, that would be great," Harper said.

The Nationals were down 5-4 in the 15th when Danny Espinosa drew a two-out walk and stole second. With no one else left to hit, Perez (1-0) batted for the first time since 2010 and bunted down the third base line. Catcher John Ryan Murphy picked up the ball but threw it wildly past first, allowing Espinosa to score.

"There was a lot of screaming and hollering," Nationals starting pitcher Stephen Strasburg said. "It's just kind of disbelief at the same time that he dropped a drag bunt and forced the catcher to throw it away."

Heisey then homered off Michael Tonkin (1-1) to complete a three-game sweep.

After Wilson Ramos hit a two-run double in the eighth that drew the Nationals within 4-3, Harper launched his ninth homer of the season, tagging Twins closer Kevin Jepsen to open the ninth.

Matt den Dekker also homered for the Nationals, who stranded 14 and went 1 for 16 with runners in scoring position.

The Twins struck out 18 times in Saturday's loss, and in this one they fanned 20 times -- including four apiece by Miguel Sano, Eduardo Rosario and Byron Buxton.

"You try to find positives," manager Paul Molitor said. "We have to regroup and put this game behind us. It is horrible stretch."

Sano hit a go-ahead single in the 15th. The Nationals rallied against Ryan O'Rourke, who retired the first two batters before issuing a four-pitch walk to Espinosa.

After Espinosa stole, Perez bunted and Murphy seemed to have time to make the play. But Murphy's throw sailed into right field for an error, putting Perez on second to set up the Perez bunt.

Strasburg retired 15 out of 16 batters until pinch-hitter Joe Mauer singled with one out in the eighth. After Eduardo Nunez beat out a high chopper, Brian Dozier homered deep into the left-field seats on Strasburg's 114th and final pitch.

Strasburg struck out 10, walked none and allowed seven hits over 7 1-3 innings. It was his 23rd career outing with at least 10 strikeouts.

Minnesota starter Tyler Duffey left in the fifth inning after being struck in the upper right arm by a line drive off the bat of den Dekker.

Duffey was summoned from the minors to pitch for Ervin Santana, who was scratched with a sore lower back. The right-hander allowed one run -- a leadoff home by den Dekker -- and five hits.