When Mary J. Blige met Nas — having both risen up from the New York projects to become hip-hop heroes — it was a case of game recognizing game, real recognizing real, royalty recognizing royalty.

“What I saw is what I actually believed he was,” says Blige, 48, of their first encounter in the mid-’90s. “He was one of my favorite rappers at the time, and it was nice to meet someone that you love, and they’re what you want them to be.”

Nas — the 45-year-old rapper born Nasir Jones — echoes the sentiment. “She was, like, everything you expected,” he says. “But when you meet people, you never know if they’re in your life for a season or a reason or a lifetime.”

But 22 years after they first collaborated on the 1997 single “Love Is All We Need,” Blige and Nas are still keeping it regal together on their co-headlining “Royalty” tour, which hits Barclays Center on Wednesday. (The trek returns to the area at Prudential Center on Sept. 8.) They’ll be pumping their latest joint jam, “Thriving,” as a testament to how they have survived and are still spreading the truth — just like they were when she was crowned Queen of Hip-Hop Soul straight off the streets of Yonkers and he broke out of his Queensbridge hood to rule the rap world.

‘We’re family now. It’s like that now.’

“She’s one of one … a treasure,” says Nas of Blige. “It’s just [been] a great friendship through the years. Every time I would see her, it was always love.”

No doubt, at this stage in their respective journeys, they’ve moved far beyond peers, contemporaries and mutual fans. “I mean, we’re family now,” says Blige. “It’s like that now.”

The two titans are also joined in hip-hop history for releasing two classic 1994 albums — Nas’ “Illmatic” and Blige’s “My Life” — which are celebrating their 25th anniversaries this year.

First came “Illmatic,” Nas’ sick debut as a 20-year-old MC, in April 1994. He set out to “make a great record” — and he did just that.

“While I was writing a lot of it, I lived in the projects. Once I got a record deal, I moved out and I wrote the rest,” recalls Nas. “My headspace was like, ‘I don’t wanna waste this opportunity to get these people’s ears and not give them something with meaning, with everything in me.’ I just wanted to give my all. But I still can’t look outside of me to really see the impact of that album.”

Blige saw it, though — and felt it: “He shared his inner-city life with us. The things he saw, I saw, you know? He captured us and made us think — and learn.”

Seven months after “Illmatic,” Blige dropped “My Life,” her sophomore album, which somehow surpassed the groundbreaking heights of her 1992 debut, “What’s the 411?” She made the LP during a dark time, which included struggles with drugs, alcohol and a tumultuous relationship with K-Ci Hailey, formerly of Jodeci.

“When I was making ‘My Life,’ I was just singing for my life,” says Blige. “I had no idea that I would even be here right now — like, living. I can still feel all the emotion and the sadness when I listen to it now. But it feels so good to know that there’s so many people that could relate and that love that album.”

Count Nas among them: “It was the soundtrack to our journey, the journey of street people,” he says. “And it reminds me of my first car — a Champagne Lexus GS 300. All kinds of thugs and everything would get in my car back then and hang out with me, and they would wanna hear ‘My Life.’ ”

Twenty-five years later, though, both Blige and Nas have endured more struggles. He went through a nasty divorce from “Milkshake” singer Kelis in 2009. Last year, the two exes finally reached a joint custody agreement over their now-10-year-old son Knight, but that still left them with issues.

“I’ve been through a whole lot, and no one really gave me advice on how to deal with what I was going through with a broken family,” says Nas, who addresses his split with Kelis on “Beautiful Life,” a track on his new compilation “The Lost Tapes 2.” “I’m optimistic that things will get better. Certain things just have to develop into a better place. But I got love for my ex-wife.”

Blige has had more relationship drama, too. After splitting with former husband and manager Kendu Isaacs in 2016, the two, who have no children together, finalized their contentious divorce last year. “It’s taken a big toll, and it’s taken a big chunk out of my life, but I don’t want that to be the message I send to these women,” she says. “I want it to be like, ‘We can move on. We can let things go so we can move forward in our life.’ I’m definitely in a stronger place.”

Still, she’s not ready to go searching for a real love just yet. “I’m not dating at all. I’m not dating by choice,” says Blige. “I’m just focused, man. I got things to do. I’m trying to just continue to build and build and structure so that when I do turn 50, things can be different. I don’t have to make the same mistakes over and over again. I don’t have to suffer the way I’ve done.”

While Blige has been “pushing past the pain,” both she and Nas can feel the love from having inspired a generation of artists who grew up on them. In fact, Nas now has his own namesake in “Old Town Road” sensation Lil Nas X.

“I’m honored,” says Nas. “I’m a fan. He’s so cool. He has a great energy about himself … He put his own swag to [my name], so I think it’s dope.”

Not that he’s ready to hang up his own mike anytime soon: “I still wanna create,” says Nas. “I don’t know how to turn the creative off … It’s just me competing with me, I guess. I can’t turn it off yet.”

And like her fellow hip-hop royal Nas, Blige is still not only surviving but thriving: “By any means necessary, I’m not going to let the failure stop me from getting to the success.”