Costa Rica, who will face England, Italy and Uruguay in Group D later this month, went ahead through captain Bryan Ruiz in the 31st minute as he converted a low, fizzing cross from the left flank sent over by Junior Diaz.

However a Japan side who have Ivory Coast, Colombia and Greece in their first-round group in Brazil then proved they possess plenty of attacking potency.

Veteran midfielder Yasuhito Endo equalised on the hour when he swept home from close to the penalty spot, and Manchester United attacker Shinji Kagawa put Japan ahead with 10 minutes remaining when he surged forward purposefully and drilled a finish into the right corner.

Substitute Yoichiro Kakitani applied the gloss to Japan's win with a low shot to the left corner in stoppage time.