Brie Larson was hanging upside down and suspended by her legs when she was about to attempt one of her most challenging “Captain Marvel” stunts for the first time on set.

It had already been a long day by the time the 29-year-old actress was dangling by a wire system. She had filmed other scenes for hours, dashed to a costume fitting and promptly returned to squeeze in this inverted rehearsal before shooting the sequence later that week.

“I remember building up to this moment, if we were going to allow her to do it — if she was going to have enough strength and confidence to get past it,” Walter Garcia, the fight coordinator and assistant stunt coordinator said.

The ‘Captain Marvel’ trailer teases Carol Danvers’ backstory and cosmic fights »

Yet as planned, Larson perfectly executed the stunt fall. She dropped four feet, flipped 180 degrees, and landed on her hands and feet.

“There was just an outburst from the whole team,” remembered Garcia.

“It was a special moment for not only the team to see her do it, but for her to build herself up to get to that point,” he said. “Because months before that, she would never consider doing anything like that.”

It’s true. Before the Oscar winner was cast as one of the most powerful heroes in the Marvel Universe, Larson was "never particularly active,” she admitted to The Times. Despite not being able to do a push-up or pull-up at the start of her training, Larson achieved her goal of performing most of her own stunts for one of the most anticipated movies of the year, out March 8.

So how did Larson gain superhero strength — and how can you?

Here’s a guide to train like a noble Kree warrior hero based on the star’s nine-month training plan — a process that helped her “get in touch with my body and strength, physically and mentally, in a way that I had never allowed myself to,” Larson said.

Warning: Use caution before trying any of these advanced moves at home.

SET AN APPROPRIATE GOAL

Larson’s initial inspiration was not a fellow superhero actor, but Emily Blunt in Warner Bros.’ “Edge of Tomorrow.” She actually tracked down Blunt’s trainer, Jason Walsh, and asked him to help her.

His first piece of advice? Don’t get caught up in achieving a certain look. Focus on building your strength, and the aesthetics will come later, said Walsh. (Blunt’s training was also focused on building strength, as she had to safely wear an exoskeleton costume on her back that weighed about 70 pounds.)

“The aesthetic thing to me is the easiest part,” Walsh explained. “I could work with someone for two weeks and put them on a diet. They would look great, but do you really think that they would hold up? There’s much more to being strong than just muscular.”

He added, “The goal was to get Brie psychologically as strong as she was physically, because I knew what that was going to do for her character. Nothing feels as good as being strong.”

Emily Blunt as Rita in the 2014 sci-fi thriller "Edge of Tomorrow." David James / Warner Bros. Pictures

MAKE A TIMELINE (DON’T RUSH IT!)

Walsh, who trained Emma Stone for “La La Land,” Alison Brie for “GLOW” and Bradley Cooper for “American Sniper,” turns down more work than he takes on due to time-frame issues. He often gets requests from studios to train actors “to be in top shape” with just a few weeks’ notice.

“There are a lot of performance-enhancement drugs out there, because unfortunately these studios have unachievable goals for people in a short amount of time,” Walsh said. “They put a lot of pressure on these actors to look a certain way, and they don’t give the kind of time that it takes.”

Here’s how Larson did it safely, which gives you an idea of how long it would take a mere mortal to get into truly elite shape:

1 - 3 months: Foundational training before “Avengers: Endgame”

3 - 6 months: Training continues during “Avengers: Endgame,” back and forth between Atlanta and L.A. Walsh noted: “This was more of a maintenance thing. You don’t want to train people super hard when they’re shooting 14- to 16-hour days.”

6 - 9 months: Focused “Captain Marvel” training, with two months of technical work for stunts and fights

So ask yourself: How much time do I have? Is my goal achievable with what I’m trying to acquire? That’s how Walsh approached Larson’s workout plan after consulting with her, the studio and the stunt teams.

TRY 5 MOVES THAT LARSON USED

If you have watched one of the “Captain Marvel” trailers, you might have noticed that Carol Danvers has a rougher fighting style than other women in the Marvel Cinematic Universe. That was intentional, says Garcia.

It’s a trend that film expert and Blerd City Con founder Clairesa Clay has noticed in recent years, with female action heroes appearing “much more valued and on par with men.”

“Superhero films are going in a direction of teaching younger women not to be afraid to be as strong as a man. You can still be feminine, you can still be a girl, but that doesn’t mean you cower to men or you’re not on equal footing.”

To help continue that trend with powerful punches and stunts, Larson began with daily 90-minute workouts for the first six months, before ramping up to twice-daily two-hour workouts. She started with these exercises:

1. Hip thrusts

Beginner: Lie on the floor, knees up, feet flat, as if you’re about to do an old-school sit up. Instead, press the back of your arms into the ground, engage your glutes, and lift your hips toward the ceiling 15 to 25 times. Continue until you feel the burn in your butt.

Advanced: Hold a 10-pound weight above your hips as you lift and lower. Keep your movements slow and controlled and add more weight as needed.

Superhero: Larson worked her way up to weighted, 400-pound hip thrusts, Walsh said.

Trainers Jason Walsh and Alyssa Shoji demonstrate weighted hip thrusts. Walsh was Brie Larson's personal trainer for "Captain Marvel." Patrick T. Fallon / For The Times

2. Push-up drills

Beginner: If you can’t do a push-up, don’t fret. Walsh helped Larson do her first one by starting with a pad on the floor beneath her chest. (You can also use a folded towel).

Start in a plank position with your arms extended. Keeping your back and waist flat, slowly lower your body. Once your chest touches the pad, drop your knees. Then perform the reverse, extending your arms, straightening your legs and returning to the position in which you started.

Next, hover in a plank position with your arms bent for 30 seconds.

Advanced: Add weight to your back. Increase as needed.

Superhero: By the end of her training, Larson could do push-ups with 50-pound, weighted chains on her back.

Bg1FwZLA6Sg

3. Bulgarian split squat

Beginner: Take a knee, with your left knee touching the ground and your right leg in a deep forward lunge.

Raise yourself up, and then lower yourself back down to the starting position, maintaining your control. Keep your back straight and your knee from moving beyond your ankle, then switch sides. An alternative starting position is resting your left foot on a step stool or bench behind you for an extra extension.

Advanced: Hold weights as you do it. Once that’s comfortable, do one and a half reps, by coming all the way down, halfway up, back down and then stand up. You can also do these across an open floor with a barbell above your head, like Larson did at times.

Superhero: Marvel’s frontwoman eventually executed these with 60-pound dumbbells in each hand, or 120 pounds total.

Personal trainer Jason Walsh and trainer Alyssa Shoji demonstrate the Bulgarian split squat Patrick T. Fallon / For The Times

4. Pull-Up Drills

Since upper-body strength was critical for Larson’s stunts, like rope swings, pull-up drills were a big part of her workouts.

Personal trainer Jason Walsh and trainer Alyssa Shoji demonstrate pull-up exercises in the West Hollywoood gym Rise Movement Patrick T. Fallon / For The Times

Beginner: With the help of a partner or by yourself, jump to the top of the pull-up bar and raise your knees. Lower yourself with control and repeat.

Advanced: Work on the weaker joint angles by jumping to the top and lowering yourself until your arms are at about 90-degrees. Hold this for 10-15 seconds. Then drop down.

Once you’re ready for full pull-ups, start with a chin-up grip, with palms facing in, since that tends to be easier. Work your way to an over-hang grip, with your palms facing out. Once you master the single pull-up, do three in a row.

Superhero: Larson went from not being able to complete one pull-up to doing six consecutive ones.

BgyRPq7g2oA

5. Landmine dead lift

Beginner: Hold a kettlebell or dumbbell that’s light enough to allow you to maintain proper form. Start by engaging your glutes, bend at the waist, maintain a flat back, and keep the weights close to your lower body. Keep the glutes engaged as you stand up, bringing your hips forward to return to the starting position. That’s one rep.

Advanced: Stagger your legs to target each side, increasing the weight when you’re ready.

Superhero: “She got to a 225-pound deadlift, which is insane,” Walsh said.

Personal trainer Jason Walsh and trainer Alyssa Shoji demonstrate landmine deadlifts in the West Hollywoood gym Rise Movement. Patrick T. Fallon / For The Times

Bonus Drill: From “Sled” to Car

The lines between actress and real-life superhero blurred when Larson achieved her ultimate goal: pushing a 5,000-pound Jeep by herself.

“She got so strong pushing and pulling the sled that we wanted to do something that was radical, and I knew she’d be safe doing it,” Walsh noted. “It’s just something she aspired to try.”

Getting to that point started with a drill that anyone can practice from home.

Personal trainer Jason Walsh and trainer Alyssa Shoji demonstrate using the sled in the West Hollywoood gym Rise Movement. Patrick T. Fallon / For The Times

Beginner: Standing arm’s length away from a wall, extend your arms and push into the wall as you run in place.

Advanced: If you have access to a weighted “sled” at your local gym, practice pushing it along an open floor, keeping your back flat.

Superhero: This is only for the strongest beings in the Marvel Cinematic Universe. Larson was able to push a Jeep for 60 seconds.

Btwrxa0D3BX

How Brie Larson trained to play a fighter pilot and a superhero »

DEVELOP A SKILL

Now that you’ve improved your physical fitness, challenge yourself to try a new technique. That’s how Larson was able to complete most of her own stunts, with the help of stuntwomen Joanna Bennett and Renae Moneymaker doubling for her in a number of scenes.

For the final two months of training, Larson worked two to three hours a day for five days a week, on top of her continued personal training, to develop authentic fighting techniques. She focused on footwork, stance, and a variety of fight choreography, including kickboxing, judo and wrestling.

“We really wanted to make her powerful and not very dainty with fluidness like [Marvel heroines] Wasp or Black Widow,” Garcia said of the fighting styles he taught her. “We wanted her to have more of a rugged kind of feel to the character so that you really feel the strength when she’s fighting.”

112545151

PRIORITIZE YOUR MENTAL HEALTH

Remember that inverted stunt mentioned earlier? That would not have been possible had Larson not maintained her mental health, asserted her trainers. Their advice is to meditate or develop a mantra to push through tough days.

As for Larson and her stunt team, they developed the motto, “This is why we train.”

That mental grit was key, said Garcia. “By the time we got to the stage that maybe would challenge most, she was able to mentally, physically and emotionally handle these things with an aggressive grace.”

CELEBRATE HOW FAR YOU’VE COME

Looking back at her intense training, Larson reflected, “Using my body as a tool that can do incredible things was the beginning of unlocking myself and unlocking who Captain Marvel is as well.”

Walsh agreed, explaining that their work in the gym was crucial for her character building.

“I think that just goes hand in hand with a superhero,” he said. “Especially in the beginning when they’re figuring out what their superpowers are, like ‘I can what? I can do this? I can do that?’ It’s very much in line with that.”

And proving that the aesthetics come when you put in the work, costume designer Sanja Milkovic Hays had to take in Larson’s costume multiple times as the actress got leaner. She made more than five suits, but the adjustments were worth it.

“Because she was so strong, she really moved like a superhero. If you’re not as strong as she is, [the costume] doesn’t look right,” Hays said.

HAVE FUN

Prepping for “Captain Marvel” wasn’t all done in the gym. "I do think it's important to say that it took a nutritionist, two different trainers, a paleo meal delivery service, a lot of mozzarella sticks, and a lot of sleep and water," Larson said.

Doughnuts and all.

Captain Marvel and the great ponytail debate for female superheroes »