Kaan Ayhan scored the winning goal in the final minutes of stoppage time.
The United States had already secured the top position in Group D.
Christian Pulisic returned to play after recovering from a calf injury.
The United States will next face Bosnia-Herzegovina in the Round of 32.