BARCELONA, Spain — They have a gold medal to chase and a golden U.S. basketball legacy to protect, so the Americans knew they had to bring their best to Barcelona.

Stephen Curry sure did.

Curry made six 3-pointers and scored 20 points Saturday, leading the U.S. national team into the quarterfinals of the Basketball World Cup with an 86-63 victory over Mexico. The Americans next play Tuesday against Slovenia, which lost to the U.S. 101-71 in an exhibition game Aug. 26 in the Canary Islands.

Curry was 7-of-10 from the field and 6-of-9 behind the arc, further evidence that one of the game’s best shooters was moving past his dismal start to the tournament. Golden State Warriors teammate Klay Thompson added 15 points.

Curry said the U.S. team is improving with every game, just as a similarly young American squad did four years ago in winning gold in Turkey.

“In 2010, we did that,” Curry said. “Every game was fun, it was energetic, just enjoying the ride and I think now we’re here in Barcelona and got our first medal game under our belt, we got the wheels going and excited to get back to work on Tuesday.”

Curry was just 4-for-17 overall in his first two games in Bilbao, though he shot better over the next three. He saved his best performance for Barcelona, where the Americans are used to them.

He made consecutive 3-pointers early in the third quarter when the Americans put away the game, the second coming as he was knocked down by a defender who was lucky not to be called for a foul.

Gustavo Ayon scored 25 points for Mexico, which won last year’s FIBA Americas tournament to qualify and then advanced as the No. 4 team out of Group D despite a 2-3 record.

The 6-foot-9 Ayon played for the Atlanta Hawks last season but his season was cut short by right shoulder surgery in February. He is a free agent and showed enough footwork and shooting touch to warrant a look from someone else.

“I’m very happy about my own participation in this game but I know I have to keep working as a team, as a player,” Ayon said through an interpreter.

He couldn’t prevent what ended up as the usual American romp in Barcelona, where the Dream Team crushed the competition in the 1992 Olympics.

The Americans averaged 117.3 points and won by 43.8 points a game then at nearby Badalona, but expect things to be a little more difficult at the Palau Sant Jordi, where they would play through the semifinals before advancing to Madrid for the Sept. 14 championship game.

“They won, so we just have to do the same thing,” center Anthony Davis.

Davis scored only four points and power forward Kenneth Faried had eight after they were the Americans’ dominant players in the first round.

The U.S. compensated by making 13 3-pointers, with their top three scorers all perimeter players.

“For a few games I think our perimeter guys were just really trying to get Anthony off because we had not looked for him and the pendulum went too far, where we’re looking at that too much,” U.S. coach Mike Krzyzewski said. “And today, it’s swinging more into the middle, and if we get that balance then we’ll be a very good — we think we are a good offensive team — but we can be an outstanding offensive team if we get that balance.”

The U.S., which had some poor starts in previous games, surged to a 13-2 lead. After Mexico answered with seven straight, the Americans pushed the score to 23-13 after one period. It stayed in double digits for nearly the entire second quarter, though Ayon had a 10-point period to keep the Americans from getting too far ahead, and it was 42-27 at halftime.

Curry’s consecutive 3-pointers made it 50-27. He had back-to-back baskets again later in the third, including a layup for his only one inside the arc, before DeMarcus Cousins’ basket made it 57-30.

Despite being bordering countries, the teams hadn’t met since the 2007 Olympic qualifying tournament. They hadn’t played in the World Cup since 1967.

James Harden finished with 12 points for the U.S. Cousins, praised by Krzyzewski for another strong performance, made all five shots and had 11 points and seven rebounds off the bench.