Ayase Ueda struck in each half to go with a late Indonesia own goal for a 3-1 win in Doha and send the pre-tournament favourites through as group runners-up behind Iraq.
Japan will now face the winners of Group E -- South Korea's group.
Jurgen Klinsmann's South Korea are currently second on goal difference behind Jordan and face Malaysia in their final group match on Thursday.
Iran are lurking as possible quarter-final opponents and Moriyasu said his team would not back down from the challenge.
"We have to be ready to face them," the coach said.
"Iran and South Korea are top-level teams in Asia and both very strong. They both have their own style that is different from ours and we respect them.
"It is a step-up in quality as we move into the race for the title."
Indonesia, who scored a late consolation goal through Sandy Walsh, finished third in Group D.
They will have to wait until the first round concludes on Thursday to see if they go through as one of the four best third-placed teams.
Japan were stunned 2-1 by Iraq in their previous game and Moriyasu made eight changes to his starting lineup.
"There were lots of issues that came out of the previous game and we worked to fix them in training," he said.
"We wanted to start the game with aggression and that is what led to our first goal."
Penalty nerves
Japan were awarded a penalty in the sixth minute after a VAR check ruled that Indonesia defender Jordi Amat had dragged down Ueda in the box.
The Feyenoord striker dusted himself down and dispatched the spot-kick past goalkeeper Ernando Ari.
"Given the result of the previous game I felt I had to score," said Ueda, who has now netted three goals at the tournament.
"I'm always nervous whenever I take a penalty but I also enjoy it."
Japan kept up the pace in the second half and Ueda doubled their lead seven minutes after the restart.
Ritsu Doan cut through the Indonesia defence down the wing and Ueda was on hand to tap home his low cross.
Ueda went looking for his hat-trick and his shot pressured Indonesia defender Justin Hubner into firing the ball into his own goal in the 88th minute.
But Indonesia got an even later goal to give their fans something to cheer about, with Walsh volleying home from close range in the 91st minute.
Indonesia, who have never reached the Asian Cup knockout rounds before, finished the group stage with three points from their win over Vietnam.
Their fate will be decided by Thursday's results and coach Shin Tae-yong said he wanted his players to be "as comfortable as possible" while watching the matches.
"Rather than watching together, I think it's better for them to relax and chill out without any stress," he said.
"I will let them watch it individually in peace."