Needing only a draw to qualify from Group E, the Asians took the lead in the 17th minute when CSKA Moscow midfielder Honda bent in his set piece from 30-yards out on the right.
- Denmark 1-3 Japan - As it happened
- Cameroon 1-2 Netherlands - As it happened
- Group E Table
Although not as spectacular, Endo's 20-yard effort followed on the half-hour mark when the outstretched Thomas Sorensen was beaten for the second time.
Jon Dahl Tomasson saw his penalty saved nine minutes from the end, but bundled in the rebound to give his side a glimmer of hope, only for Shinji Okazaki to seal Japan's triumph and book a last 16 tie against Paraguay.
Japan coach Takeshi Okada named an unchanged team for the third match in succession, while his counterpart Morten Olsen was boosted by the availability of Nicklas Bendtner, who passed a late fitness test.
Per Kroldrup was drafted in for the suspended Simon Kjaer, with Jesper Gronkjaer replaced by Thomas Kahlenberg.
The Scandinavians had the first real chance inside five minutes, but Tomasson found himself in the wrong position as he tried to deal with a deflected Simon Poulsen cross and the chance went begging.
Yoshito Okubo then sent in a low cross from the left that was flicked on nicely by Daisuke Matsui 10 yards out, only for Sorensen to intervene outstandingly with his feet.
Moments later Makoto Hasebe latched on to a defence-splitting pass, but wastefully shot over.
At the other end captain Tomasson was again played in, on the left side of the box this time, but his low shot curled agonisingly wide.
The deadlock was broken the next time Japan went up-field thanks to Honda's stunning free-kick, his second goal so far at the finals.
It came after Matsui was fouled 30-yards out on the right and a curling and dipping shot was sent over the wall into the far corner beyond an outstretched Sorensen.
Tomasson had his third chance inside the opening quarter when Christian Poulsen lifted the ball over the defence, but the Feyenoord front-man failed to connect cleanly and Eiji Kawashima parried the ball away to safety.
Endo then made it 2-0 when he bent his free-kick around the wall into the right-hand corner.
After Christian Poulsen tried his luck from distance, Sorensen prevented his side falling further behind before half-time when he tipped over Yuichi Komano's effort from the right.
The Stoke City goalkeeper was saved from embarrassment by his right-hand upright less than three minutes after the restart when he spilt a routine catch from an Endo free-kick.
Kahlenberg then seemed to be taken by surprise when the ball came to him at the back post, guiding the ball wide from a tight angle, while Tomasson was again let down by his control in the six-yard box after Lars Jacobsen swung over a useful cross from the right.
Denmark continued to pile on the pressure and substitute Jakob Poulsen was next to come close, with his long-range effort punched away by Kawashima.
Christian Eriksen, another replacement, then saw his strike from outside the box fade away as the Danes looked short of ideas.
When they did manage to get into the penalty area, the out-of-form Tomasson, on a 15-match goal drought before tonight, was unable to convert.
With 11 minutes to play, another effort from distance by Soren Larsen left the cross-bar shaking, but seconds later Tomasson finally managed to hit the back of the net.
After Daniel Agger received a shove in the back to win a penalty, the veteran striker saw his shot stopped by Kawashima, but the rebound was unconvincingly sliced hope.
It gave Denmark hope, but substitute Okazaki killed their spirit in the 87th minute when Honda teed him up to send Japan through.