Starting the day on a point each, both teams knew they needed a victory to have any chance of progress and Portugal started strongly as Ronaldo hit the bar and sent a close-range header straight at goalkeeper Fatawu Dauda before Ghana's John Boye sliced a cross into his own net after 31 minutes.
Asamoah Gyan headed the equaliser from a lovely Kwadwo Asamoah cross 12 minutes into the second half and Abdul Majeed Waris missed the chance to put Ghana ahead when he headed wide from point-blank range five minutes later.
Ronaldo finally found the net in the 80th minute but Portugal, thrashed 4-0 by Germany in their opening game, needed a far bigger win to overhaul the Americans' goal difference.
Germany topped the group with seven points and play the Group H runners-up - probably Algeria, Russia or South Korea - while the second-placed US will face the Group H winners, likely to be Belgium. Portugal finished with four points and Ghana on one.