The two sides exchanged goals throughout the match but Spain were forced to come from behind to secure three crucial points, only taking the lead for the first time in the penultimate minute as captain Nico netted the decisive goal.
The match was a torrid affair played at high pace with regular opportunities at either end, and eight different goalscorers found their way onto the scoresheet.
Ray Futagaki opened the scoring for USA midway through the opening period, only for Antonio to draw the two sides level with the first of his two goals.
The Stars and Stripes quickly established a 3-1 lead but three goals in the final six minutes proved to be their undoing against a nation who have reached the knockout stage on four previous occasions.
The match was an impressive return to the world stage for USA after they failed to qualify for the past three tournaments.