TAMPA - Manchester United striker Shinji Kagawa scored the go-ahead goal in the 80th minute Monday as Japan defeated Costa Rica 3-1 in a World Cup warm-up friendly for both teams. Kagawa stumbled as the ball came to him in the heart of the penalty area but kept his balance and swept a right-footed shot past Costa Rica goalkeeper Keilor Navas to give Japan a 2-1 edge.Yoichiro Kakitani, who came off the bench in the 76th minute, added an insurance goal in stoppage time for the Blue Samurai, who trailed 1-0 at halftime after finding only frustration from a flurry of chances. "It was good that we could come back and win after we fell behind," Kagawa said. "We should have scored a goal in the first half. We had good chances. We need to score first in the World Cup because those are going to be tough matches."Costa Rica captain Bryan Ruiz, a striker for Dutch side PSV, opened the scoring in the 31st minute, outracing Japan defender Yasuyuki Konno to a centering pass and flicking the ball into the back of the net. But Yasuhito Endo, a 34-year-old midfielder for Gamba Osaka who entered to start the second half, equalized for Japan in the 60th minute. Japanese captain Keisuke Honda, a forward for AC Milan, left-footed a centering pass to the heart of the penalty area, where onrushing Endo -- the oldest man on either roster -- blasted a shot into the back of the net."Our condition was good and we played with a positive mentality," Japan coach Alberto Zaccheroni said. "For the rest of the time until the World Cup we will focus on improving the players' mentality and on finishing goals. "Kagawa and Honda, they played well. They both needed some time to get used to the game but they played well." Costa Rica coach Jorge Luis Pinto said the match had World Cup-level intensity."We had our World Cup rhythm," Pinto said. "We were counter-attacking and moving the ball well, a high pressure, a World Cup feel. We played as intensely as we could." But Zaccheroni said Japan's attacking style paid off at the end by draining the Ticos of energy for the vital final minutes. "We made a lot of chances," he said. "We kept making them run and pass the ball and they got tired and we dominated the game -- eventually." After a last tuneup Friday in Tampa against Zambia, Japan will fly to Brazil on Saturday and open Group C play June 14 against Ivory Coast with later matches against Greece and Colombia. Costa Rica, which plays a final warm-up friendly against Ireland on Friday at Philadelphia, was drawn into Group D against England, Uruguay and Italy. The Ticos open World Cup play against Uruguay on June 14."We were able to create but our middle was exposed and certainly the defense made some bad decisions on the second and third goals," Pinto said. "We made some mistakes. It's a process. Some of our players will look to improve in the next week."Both teams hoped to adapt to the heat and humidity of Brazil by playing in similar conditions before 7,106 at the Florida home stadium of American football's Tampa Bay Buccaneers.The match came five days after the death of Buccaneers and Manchester United owner Malcolm Glazer at age 85. Costa Rica, reeling from the loss of star scorer Alvaro Saborio to a broken right foot and left back Bryan Oviedo to a broken leg, tested new starters. Joel Campbell, the Olympiacos striker who at 21 was the youngest man on the pitch, got the nod up front while Junior Diaz, a 30-year-old for German side Mainz, received the back line call.Time and again the Asian champions pressed the attack in the first half only to come away empty. Yuya Osako nodded a centering pass over the crossbar in the 11th minute and moments later Kagawa evaded defender Michael Umana in the middle but fired a right-footed shot wide. Honda blasted a shot off the right post in the 24th minute and Yoshida Okubo forced a diving stop by Navas in the 25th.Honda was again thwarted in the 27th minute after evading Navas only to have defender Giancarlo Gonzalez clear the ball from danger. Hotaru Yamaguchi forced another tough save by Navas in the 29th minute and Kagawa yet another in the 41st minute.