With the game tied at 5, Christian Villanueva doubled to lead off the ninth against Takeru Imamura. Baez then launched the first pitch he saw over the left-field fence for the winner.
Sho Nakata and Hayato Sakamoto each hit two-run home runs in Japan's chance to prep for the World Baseball Classic's Championship Round.
The two-time defending Classic champions, Japan will head to San Francisco for the semifinals, awaiting the No. 2 seed to emerge from a group of three teams comprised of the Dominican Republic, the United States and Puerto Rico.
Cubs pitcher Kyuji Fujikawa, who pitched for Team Japan in the 2006 and '09 World Baseball Classics, took out the lineup card and exchanged it with Japan's Shinnosuke Abe. It was a loud game during Japan's at-bats, as fan Ken Koshio of Phoenix kept it lively with his drums, whistles and noisemakers.
"This is the Japanese way of cheering," Koshio said.
"It's like playing in Cleveland," Cubs outfielder David DeJesus said of the drum beating.
Baez walked with one out in the Chicago first, Welington Castillo doubled and Alfonso Soriano hit a sacrifice fly against Japan starter Tetsuya Utsumi. Dave Sappelt then hit an RBI double to go ahead, 2-0. Josh Vitters added a RBI single before shortstop Sakamoto made a leaping grab of Jorge Soler's line drive to end the inning.
With one out and one on in the Japan second, Nakata launched a 2-1 pitch from Cubs starter Travis Wood to left to close the gap to 3-2 in favor of the Cubs. Abe tied the game with one out in the third, hitting a one-out RBI double to drive in Kazuo Matsui, who reached on a throwing error by Baez. Sakamoto followed with his home run to left-center off a 1-0 pitch from Wood.
"They had good swings, good approaches and I've never seen them before so it was interesting to try to figure them out as I try to figure me out," Wood said. "I'm trying to work on things I'm trying to fine tune for the season and go from there."
Baez hit his third spring home run with two outs in the Chicago seventh, and the Cubs tied the game in the eighth. Sappelt singled, advanced on a sacrifice and one out later, scored on Daniel Vogelbach's single. Vogelbach was thrown out at home trying to score the go-ahead run on Alberto Gonzalez's single.
Wood wasn't sure what to expect.
"Some of them had some nice power, as you could see," the left-hander said. "It was an interesting experience to go out and play against them. They're fundamentally sound and play good ball. That's all there is to it."
DeJesus went 1-for-3 with a double in the exhibition.
"It was cool to play against them," he said. "You can see the talent they have. They have some quick bats on that team. Throw anything in, you miss in, and they turn on it pretty good. It was great to see Woody have to pitch to get these guys out. Their pitchers, it was pretty cool to face them, because they didn't just come at you. They're going to work away, work in, work back up -- they worked all the planes of the batter's box."
For Soriano, the exhibition gave him a chance to revisit with his former infield coach, Nobuhiro Takashiro, who is on the Team Japan staff. Soriano played for Hiroshima from 1995-97 before joining the Yankees in 1999, and was a shortstop then.
"The hard work I did in Japan made me a better player now," Soriano said. "I'm glad to see him again. It reminds me of my time in Japan. I have a lot of memories, good times."
Takashiro did not speak Spanish but was able to communicate with the then 19-year-old Soriano. How did they talk?
"My little Japanese that I learned," Soriano said.
Although he's rooting for his native Dominican Republic, Soriano predicted Japan will do well in the Classic.
"I haven't seen the team play yet, but the way they practice, the way they play the game, I don't have to see the team," Soriano said. "They're a very good team. I don't have to see them to know that team is very good."
Good enough to beat the Dominican Republic squad?
"The Dominicans have a power team," Soriano said. "Japan does the little things right."
"Dominican," he said, smiling.
Up next: Two-time defending Classic champion Japan will play the second-place team from the Miami group, meaning it will face the Dominican squad, Team USA or Puerto Rico on Sunday at 9 p.m. ET in San Francisco. The winner of Sunday's semifinal moves on to the final, Tuesday at 8 p.m. ET at AT&T Park.