WARNING: The following contains spoilers for Paramount Pictures' Bumblebee, in theaters now.

Director Travis Knight and writer Christina Hodson had enormous task in making Bumblebee resonate with audiences while also moving away from from the failures of 2017's Transformers: The Last Knight. Judging from early reactions to the sixth installment of the Paramount Pictures franchise, they've largely succeeded by positioning the fan-favorite Autobot as a refugee on Earth, evading pursuing Decepticons while preparing for the arrival of Optimus Prime and his comrades.

However, the Decepticons track down Bumblebee, to 1987 in San Francisco, where they partner with the U.S. government's Sector 7 to imprison the Autobot and extract his secrets. That leads to a high-octane, yet emotional, finale that sees Bumblebee evolve into something more than a soldier.

THE DECEPTICONS PHONE HOME

After his human ally Charlie (Hailee Steinfeld) and her neighbor Memo (Jorge Lendeborg Jr.) sneak into Sector 7's makeshift base, they find Bumblebee powered down after receiving a blast from Dropkick (voiced by Justin Theroux). The Decepticons have already snuffed out Optimus Prime's message about coming to Earth, and the robots head to a cell tower at a nearby port to transmit the data to the rest of Megatron's army.

RELATED: "More Than Meets the Eye" Is the Core Moral For Bumblebee's Story

However, Charlie takes the electric stun guns used by Sector 7 used to restrain Bumblebee and transforms them into defibrillators to power the Autobot back to life. But after a confrontation with Agent Burns (John Cena) and his operatives, Bumblebee nearly goes into kill mode, only to be pulled back by Charlie. She calms him down and they speed off to foil their enemies.

AN ALLY HAS BEEN GAINED

Bumblebee

At the port, Shatter (voiced by Angela Bassett) is loading up the transmission for Cybertron, and instructs Shatter to finish off Bumblebee. However, the Autobot outwits the Decepticon by chaining him up as he tries to transform into a helicopter, resulting in him being pulled apart. Despite being weakened by the fight, Bumblebee saves Agent Burns when Shatter shoots down Sector 7's helicopter, which confirms he's been hunting the wrong robots all along.

REVIEW: Bumblebee Is a Refreshing Reset of the Transformers Series

Juggling all of those actions works against Bumblebee, though, as Shatter blindsides him. That buys time for Charlie to end the transmission to Megatron and disable the tower. But just as an enraged Shatter is about to kill her, Bumblebee wrestles his enemy to the ground, and then shoots down a barge from its storage unit, bringing it crashing into Shatter, killing her. Bumblebee ends up stranded beneath the water, but Charlie, who stopped diving professionally after her father's death, jumps in to help him resurface. Agent Burns finally acknowledges them as heroes and stalls his soldiers, providing them time to escape.

An Emotional Farewell

Bumblebee drives to a hill overlooking the Golden Gate Bridge, as it's time for him to leave San Francisco. He invites Charlie to continue their adventures, but she tells him she has people who need her, just like he does. Capping a sentimental goodbye, he transforms into a Camaro (a nod to Michael Bay's 2007 Transformers film) and drives off.

The final scenes show an inspired and confident Charlie reconnecting with her family and with Memo, as Bumblebee ends up on a highway alongside a red tractor-trailer. It's a glorious moment as we see this truck has no driver; it's Optimus Prime in his classic Generation One form.

Directed by Travis Knight from a script by Christina Hodson, Bumblebee stars Hailee Steinfeld, John Cena, Jorge Lendeborg Jr., Pamela Adlon, Jason Drucker, Abby Quinn, Rachel Crow, Ricardo Hoyos and Gracie Dzienny.