Australia are almost certain to appear at a sixth consecutive edition of the World Cup, after a last-gasp qualifying win over Japan.