BARCELONA, Spain (AP) _ Spain rallied for three runs in the ninth inning Sunday to finish the Olympic baseball tournament with its first win, a 7-6 victory over Puerto Rico.

Luis Leon's pinch-hit, two-run single highlighted Spain's three-run ninth off James Figueroa.

Felix Cano hit a grand slam to help Spain (1-6) take a 4-3 lead into the ninth, but Puerto Rico (2-6) rallied for three runs off starter Xavier Civit.

Angel Morales had a single and sacrifice fly and drove in three runs to lead Puerto Rico.

Neither team qualified for medal play, which begins Tueday.