WARNING: The following contains spoilers for WandaVision Episode 9, "The Series Finale," now streaming on Disney+.

When WandaVision revealed the sinister Agatha Harkness was secretly manipulating Westview and hurting Wanda, fans were left wondering how exactly she planned to escape retaliation. But the ever-resourceful Agatha knew exactly how to play Wanda, seeding disbelief and doubt in her mind so she could take advantage.

The icing on the cake of her twisted plan came when she lured Wanda down to her lair, which was full of magic that had a way to nullify the Avenger's powers. However, Agatha would come to regret that decision because Wanda is able to exact revenge by beating the witch at her own game in the finale.

RELATED: WandaVison's Finale is a Satisfying Resolution, the Show's Director Promises

Agatha Harkness in WandaVision

As Agatha spilled the truth in WandaVision's penultimate episode, Wanda tries to use her powers on the witch, but they don't work because there are runes engraved in the basement, negating Wanda's Chaos Magic. Agatha explains that only the witch who cast the spell could use her powers in this space, which is why she's able to torture Wanda. However, knowing Wanda's destined to be the Scarlet Witch, Agatha lets her out, not just to allow her to save her family, but also for a fight. The witch plans to use the same absorption spell she used on her mom and the coven back in Salem, and Wanda falls for it hook, line and sinker. Whether she's shooting blasts or creating shields to protect her loved ones, the more red energy she conjures, the more Agatha drains her Chaos Magic.

However, when they take to the skies in the final act, just when Agatha thinks she's broken Wanda's mindscape and is a step closer to stealing all of her essence, the Scarlet Witch reveals a trap of her own. Agatha tries to bargain for Wanda's power, promising she'll let her, Vision and the twins live in Westview forever. Enraged, Wanda decides to chuck her power at Agatha, who readily takes it all in. There seems to be some relief on Wanda's face, maybe believing her powers were more a curse than a blessing, but that still doesn't stop Agatha from wanting to turn on a frail Wanda and kill her. But just when Agatha goes in for the final blow, she discovers she's lost her abilities, similar to when Wanda ran out of juice in the basement.

RELATED: How Monica's WandaVision Journey Parallels Wanda's Story

Wanda confesses she learned a lot from Agatha's basement lesson and secretly created runes on the hex in order to stop her enemy from using her magic. She's finally embraced her role as the Scarlet Witch, and using this trick, she allows the very thing that handicapped her to empower her. The Scarlet Witch then takes the remainder of Agatha's power and traps her in Westview to continue her life as the "nosy neighbor." Wanda may not have been as skilled as Agatha, but she wasn't going to let anyone get between her and her family.

Written by Jac Schaeffer and directed by Matt Shakman, WandaVision stars Elizabeth Olsen as Wanda Maximoff/Scarlet Witch, Paul Bettany as Vision, Randall Park as Agent Jimmy Woo, Kat Dennings as Darcy Lewis, Teyonah Parris as Monica Rambeau and Kathryn Hahn as Agnes.

KEEP READING: A WandaVision Guide: News, Easter Eggs, Reviews, Recaps, Theories And Rumors