MEXICO CITY (AP) Gustavo Ayon scored 16 of his 38 points in the fourth quarter and Mexico overcame a 15-point deficit to hand Argentina its first loss of the Olympic qualifier, 95-83 on Wednesday night in the last game of the second round.

Ayon also grabbed 14 rebounds, while Jorge Gutierrez scored 23 points and Francisco Cruz added 21 for the Mexicans. They earned the No. 2 seed and will face Argentina again Friday night in the FIBA Americas semifinals.

Earlier, Canada beat the Dominican Republic 120-103 to finish first and will play Venezuela in the other semifinal.

More from FoxSports

The winners will get the two Americas' berths into the 2016 Olympics. The losers will play in the 2016 FIBA Olympic qualifying tournament.

Mexico is trying to qualify for its first Olympics since Montreal in 1976.

Luis Scola scored 26 points and Andres Nocioni added 21 for Argentina.

Canada won its seventh straight game as Cory Joseph scored 17 points to lead a balanced attack.

Anthony Bennett and Nik Stauskas each scored 14 points for a Canadian team that features nine NBA players and is one of the favorites to earn one of the berths in Rio.

''We did the job in a tough day because we played an emotional game last night,'' said Canada coach Jay Triano, whose team beat Mexico on Tuesday night. ''The legs were tired and we needed to turn it around quickly against a team that plays unconventional basketball. I'm happy with the win and we have 48 hours to prepare for the big game.''

Canada is trying to qualify for its first Olympic games since Sydney in 2000.

Venezuela qualified for the semifinal round with a 75-62 victory over Panama.

John Cox scored 21 points and Heissler Guillent came off the bench to add 13 for the Venezuelans, who are trying to qualify for their first Olympics since Barcelona in 1992.

Venezuela was a surprise because it came to the tournament without three of its best players: Greivis Vasquez of the Milwaukee Bucks, Luis Bethelmy and Gregory Echenique.

''No one saw us as guests to the dance of the final four, but we are there and we earned it,'' said Venezuela coach Nestor Garcia. ''Everybody thinks that we are a team that's one step below the other three and we are going to use that to our advantage because we have everything to win and nothing to lose.''

Also Wednesday, J.J. Barea scored 19 points, Renaldo Balkman added 17 and Puerto Rico got an 80-69 victory over Uruguay to finish fifth and clinch a spot in the 2016 FIBA Olympic qualifying tournament, to be played July 4-10.

''The first half was the best defensive effort that I have seen in a long time. I'm really proud with this group,'' Puerto Rico coach Rick Pitino said. ''We came in here limping, but we will play next summer with a healthy team and we will try to make it to Rio.''