On Friday, while many of his Warriors teammates relaxed on beaches, Juan Toscano-Anderson signed autographs for hundreds of elementary school students at an outdoor court in Monterrey, Mexico.

When Toscano-Anderson was MVP of Mexico’s top basketball league two years ago, he got used to posing for pictures and signing jerseys. But this crowd, which engulfed the entire court as it chanted his name, was at a level typically reserved for the top Mexican soccer players.

“I felt like a rock star, man,” the forward said after a recent Warriors practice. “What Steph (Curry) and those guys are like here, that’s kind of what I’m like in Mexico. And I say that humbly. It’s just a total honor.”

Soccer has long been Mexico’s most popular sport by a wide margin, but basketball is beginning to gain traction. One of the NBA’s biggest obstacles in recent years was that it didn’t have a Mexican player for fans to cheer. That changed this month, when the Warriors signed Toscano-Anderson to a contract for the remainder of the season.

Less than five years ago, Toscano-Anderson was living at his mother’s house in East Oakland as he tried to come to terms with the sudden end of his basketball career. Now, as the NBA’s first player of Mexican descent since former Cal guard Jorge Gutierrez made his final appearance with the Charlotte Hornets in 2016, Toscano-Anderson represents the most populous Spanish-speaking country in the Americas whenever he checks into a game.

His No. 95 jersey is a nod to his maternal grandfather, who moved from the Mexican state of Michoacán in 1965 and bought a house at 95th Avenue and A Street in Oakland’s Elmhurst neighborhood. It was there, in a predominantly African American area, that Toscano-Anderson grew up speaking Spanish, celebrating Cinco de Mayo and eating his grandmother’s Mexican food.

Toscano-Anderson has little relationship with his African American father’s side of the family. When his third-grade teacher — Al Attles’ wife, Wilhelmina— took him to a Warriors-sponsored basketball camp, Toscano-Anderson returned home and told his soccer-obsessed grandpa, who asked, “Why would you want to play that sport?”

By the time he became a four-star prospect at Castro Valley High School, he was known simply as “Juan Anderson.” The shortened name was not intended to be a slight to his Mexican heritage. With some of the top Division I programs recruiting him, he figured it was easier to go by his dad’s surname.

After averaging 3.8 points per game over his four-year career at Marquette, Toscano-Anderson didn’t receive a single offer to play overseas, much less in the NBA. Though he had a bachelor’s degree in criminology, he struggled to envision a career away from basketball.

After a couple months playing video games at his mom’s house, Toscano-Anderson got a call from the Mexican national team, which wanted to fly him to Mexico City for a tryout. With “Toscano” on the back of his jersey, he built a reputation at the 2015 FIBA Americas championship as an instant-energy small forward who defended multiple positions, attacked the glass and didn’t try to do too much offensively.

This was enough for Toscano-Anderson to land a contract from Soles de Mexicali in Mexico’s top league. Over the next three years, he blossomed into the country’s best player, winning two league titles, a dunk contest and an MVP award.

When Toscano-Anderson went out to dinner, the restaurant owner often offered to pay for his meal. His likeness appeared on billboards throughout Mexico. Though the league wasn’t considered among the world’s best, it offered Toscano-Anderson a six-figure salary, a luxury apartment in Monterrey and a chance to reconnect with his Mexican roots.

“Playing in Mexico revived my career, no question,” Toscano-Anderson said. “Without the people there, who knows where I’d be today?”

Over the past two years, as he made the G League’s Santa Cruz Warriors in an open tryout; impressed head coach Steve Kerr in a preseason stint with Golden State last fall; and emerged as Santa Cruz’s emotional leader, Toscano-Anderson sometimes missed the life he’d left in Monterrey. But to ensure he wasn’t dogged by regret, he knew he needed to see if he could carve out an NBA niche.

When Toscano-Anderson’s alarm sounded at 8 a.m. on Feb. 6, he checked his iPhone to find three missed calls and a text from the Warriors’ director of team development, Kent Lacob: “You need to wake up.”

A hectic trade deadline was about to leave Golden State with only nine players on the 15-man roster. To help get them back to the league’s minimum requirement of 14, the Warriors wanted to sign Toscano-Anderson for the rest of the season.

When Lacob told him the news, Toscano-Anderson, teary-eyed, embraced his girlfriend at their Santa Cruz hotel room. It wasn’t just the realization of a longtime goal that made him emotional. In that moment, Toscano-Anderson understood what an NBA contract would mean for Mexicans and Mexican Americans.

In an effort to tap into the Mexican and Latino markets, Commissioner Adam Silver has brought NBA games to Mexico City, built a youth development academy there and announced plans to establish a G League team there next season. But Silver recognizes that, for basketball to come close to rivaling soccer in popularity, Mexicans must be able to root for players who look like them.

Since Toscano-Anderson signed with Golden State, he has received daily messages on Instagram, Twitter and Facebook from Mexican-born or Mexican American players with NBA ambitions. While in Monterrey last week, several parents told Toscano-Anderson that, if not for him, their kids wouldn’t believe a professional basketball career was possible.

“I’ve always had that chip on my shoulder where I never wanted to quit anything,” Toscano-Anderson said. “Now more than ever, I feel like I have an obligation to continue to raise the bar for these kids I inspire.”

Connor Letourneau is a San Francisco Chronicle staff writer. Email: cletourneau@sfchronicle.com Twitter: @Con_Chron