NOTE: This spoiler sent in by Rahul.
The movie starts off in 1989. Mike O'Donnell (Zac Efron), the handsome teenage high-school basketball star, practises shooting hoops. Coach Murphy (Jim Gaffigan) comes in and tells him to take it easy. A scout is coming in for the game tonight and Mike is a shoo-in for a scholarship. The coach calls all the players in for a photoshoot, but Mike tells them to wait for Ned, the waterboy. The others are scornful of Ned, but Mike says he's part of the team. Ned Gold (Tyler Steelman) comes in, dressed up as a Harry Potter-esque wizard, stumbling over his robe. The other players laugh at him, except for Mike (his best friend). They pose for the picture. Just as it clicks, one of the jocks gives Ned a wedgie, making him jump.
Game time! As the cheerleaders (for Mike's team, the Hayden Warriors) do their routine, Mike joins in, dancing and posing for the cheering crowd. As he prepares himself for the game, he sees his girlfriend, Scarlett, standing by the rafters, waving at him. He runs over and gives her a big hug. He also makes a shooting pose for her (a special pose for her). She seems a bit tentative though. He asks her what the problem is, but she tries to brush it off. He persists and she tells him. The news is obviously heavy, as he seems completely dazed. The game starts and Mike's mind is not in it. He just stands on the floor, dribbling the ball, pondering. His teammates, coach and the crowd are shocked to see him do nothing. He watches Scarlett walk out sadly. He makes a decision and throws the ball over his shoulder, to everyone's dismay, and runs to Scarlett. The coach sees the scout metaphorically close his book. Mike catches up to Scarlett and tells her he wants to be there for her. She tells him that he has a future, but he retorts that the baby is his future. She tries to walk away, but he kisses her, ending the discussion.
And then, he wakes up TODAY, looking like Matthew Perry (haven't we all had nightmares of waking up as Chandler Bing?). He's in his buddy, Ned's, house. Ned (Thomas Lennon) is now a billionaire. As they have breakfast together (Ned is still quite an awkward guy, with Mr. Spock-like ears), they talk about Mike being kicked out by Scarlett (now his ex-wife) and his kids not wanting to be with him. However, Mike is up for a big promotion and he's quite excited about it.
Mike goes to the office, at Wyatt Pharmaceuticals. He sits in a meeting, where the boss, Dean, talks about a new drug that gives a four-hour erection. Except for Mike, all the other people, seated at the conference table, are attractive ladies. Dean brings up the topic of the promotion, and everyone sits up, excitedly. Dean announces that the promotion has been awarded to one of the attractive ladies. While all the ladies celebrate, Mike is nonplussed. When all the ladies leave, he confronts Dean. He tells him that he's been at the company for 16 years, while the lady was there for only a couple of months. Dean brushes him off to take a call, but Mike yanks off his bluetooth earpiece and smashes it furiously against the wall. As the celebrating ladies file into the elevator, they pay no heed to Mike, who stands there morosely with all his stuff dumped in a box. He's either been fired or he's quit. Like it matters, huh?
He drives over to his old alma mater, Hayden. He goes onto the empty basketball floor and reminisces for a while. He looks at the trophy cabinet in the hall and looks at his old 1989 picture. The school janitor (Brian Doyle-Murray) comes along and recognizes him. He tells that he was a high-school star who didn't live up to his potential. He says that people come back to look back upon the glory days, like they were living in the past. Mike prefers the past, as it was better for him. The janitor asks him if he wants a do-over, to which Mike nostalgically says "yes". The janitor smiles. Just then, Mike's daughter, Maggie (Michelle Trachtenberg), and her friends come up. Mike notices that the janitor has disappeared. He tells her that he's there to take her and her brother for ice-cream. He pretty much forces them to go.
At the ice cream place, while other kids and their parents have fun, Mike, Maggie and Alex (Sterling Knight) sit quietly at a table. Maggie and Alex are none too pleased about being there, especially with their dad. Maggie listens to her IPod while Alex plays on his PSP. He tries to talk to Alex about trying out for basketball. Alex, too busy to look up from his PSP, just answers noncommittally. To get his dad off his back, he tells him that Maggie got into Georgetown. Mike tries to congratulate her, but she ignores him, acting like she's grooving to the music, though her earphones are not even plugged in. He drops them home, where they just walk inside without a word to him. He sees Scarlett (Leslie Mann) in the backyard, throwing his stuff into a woodchipper. Their divorce is not final yet, but she's already started shutting him out of her life. She's pissed at him for all his complaining about how his life could have been different, all these years. He tells her that he's disappointed with his life. She angrily tells him that now they're not holding each other back any more. She'll see him in court. Her friend, Naomi (Nicole Sullivan), arrives. Mike and Naomi are a bit antagonistic to each other. Naomi tells Scarlett that she should get back on the market. Scarlett says goodbye to Mike and goes inside the house. Unhappily, Mike walks out, just as it starts to rain.
He drives in the rain. His car radio starts to malfunction, switching stations every second. As he drives on a bridge, he sees a man standing on the edge, about to jump. He stops quickly and shouts to the man. The man turns - it's the janitor from Hayden High. He smiles at a surprised Mike, just as a truck passes by. When it passes, the janitor has disappeared off the edge. Mike runs to the edge and looks down into the water. To his shock, he sees a whirlpool and his younger (1989) self reaching out to him. Suddenly, he falls into the water.
A while later, he reaches Ned's place, completely muddy and wet. He stands in the shower, hosing himself off. Then he looks in the mirror and screams out. He's back to being a Zac Efron lookalike (his 1989 self). Ned wakes up, hearing the scream. In the bathroom, Mike looks at himself in disbelief. Ned enters, with a 300-esque Spartan helmet and a battle-axe (Man, what a fanboy!). Seeing the younger Mike, he swings the axe at him. They scuffle a bit, with Mike trying to explain, but Ned's too scared. Thanks to being younger and more agile, Mike manages to defend himself against the hysterical Ned. Soon, they're fighting with light-sabres. Mike recalls past events about Ned to prove it's him, but Ned manages to drop Mike. As he prepares to bean Mike with a picture-frame, he sees the picture of the two of them graduating in 1989. Finally getting it, he drops the frame... right onto Mike's head, knocking him out.
When he comes to, he and Ned try to understand what happened. Ned, after asking a lot of sci-fi-related questions, decides it's got to be Spirit God Transformation Magic. Mike figures out that the janitor must be his "Spirit God". Still in older Mike's dirty (and much looser) suit, he speeds off to Hayden High, where he urgently asks the students where the janitor is. He sees a female janitor who tells him that she's the only janitor at the school. After she leaves, he sees Alex and tries calling out to him. Alex runs off. Mike sees the lights flickering and a pool of water on the floor, leading to a door. He follows the water trail and sees a bucket and mop, standing unattended outside a room. Looking inside the room, he sees it's the gym/basketball court.
He runs back to Ned's and says he knows what he has to do. He's going back to high school. Ned is skeptical, but Mike is resolute. Ned refuses to have anything to do with this. And soon... he's introducing Mike to the principal as a new student, "Mark". Mike's dressed all weird, like Kevin Federline (he doesn't know that's not a good thing). As they go to meet the principal Jane Masterson (Melora Hardin), Mike bumps into Stan (Hunter Parrish), a mean jock. The moment Ned sees Jane, it's love at first sight. Thanks to Ned's doctored documents, Mike (or "Mark") is accepted into the school. Ned tries to hit on Jane, but Mike drags him out. As they walk through the halls, the students rip on Mike's K-Fed-like clothing. So Ned takes him shopping.
The next day, he comes in a flashy sportscar, wearing much more respectable but stylish attire. People check him out as he walks into school. Once he's in the hall, the bell rings and the hall is crowded by quick-walking students, who shoulder-bump and push him about as they walk. In his class, he gets a call from Scarlett. He's late for the divorce hearing. He tries to lie, saying he's out of the country, but they hear the cheerleaders behind him. One of them asks him out on a date. Scarlett's lawyer pushes for full custody of the kids, but Mike argues. He sees Maggie walk inside. He says that he's closer to them than she thinks and asks to reschedule. He waves at Maggie.
During gym class, he finds he still has his basketball skills. He catches the eye of Coach Murphy (yes, the same one, only 20 years older). He asks Mike to show up for tryouts. In the bathroom, Mike calls Ned to report the good news. After hanging up, he sees Alex, sitting duct-taped to a toilet. Outraged, he asks who did it. Alex replies "the basketball team". Mike is surprised that his son is not popular. He introduces himself as "Mark Gold", his uncle Ned's son. He starts to undo the tape, much to Alex's agony. They go to lunch, where Mike says they should look out for one another. Alex seems interested in a girl named Nicole, the head cheerleader. Just then, the basketball team, led by Stan, enter. They walk into the cafeteria, pushing smaller kids out of their way and stealing their lunches. Stan is also Maggie's boyfriend. Seeing her and Stan kiss, Mike is a bit unhappy that Maggie is dating a bully. Stan approaches them and pushes Alex around. Mike stands up for his son. He verbally humiliates Stan, calling him a bully and a "dick", while expertly spinning Stan's basketball, much to the delight of the whole school.
At Ned's place, he eats junk food, while lamenting the fact that his son is a punching-bag and his daughter is a bully's girlfriend. He now understands his "Spirit Path". He has to help out his kids. He goes to his - actually his ex-wife's - house. In the yard, he sees Alex shoot hoops. Alex seems pretty good at basketball. Mike realizes that Alex should be on the basketball team, as part of his Spirit Path. Just then, Scarlett and Naomi pull up in the car. Alex introduces Mike as "Mark, Ned's bastard". A bit drunk, Scarlett seems a bit taken aback when she sees Mike. She grabs his face and pulls his cheeks, saying that he looks so much like her husband. Naomi drags her away and advises her to hook up with someone else. Mike throws the ball at Naomi and acts apologetic, though he does politely berate her for trying to hook up a married woman.
Next day, at school, entering class, he sees Stan and Maggie in liplock. He breaks it up innocently and sits. The subject for the day is Abstinence. Mike announces that it's a great idea and everyone should make a pact to abstain from sex. He gets a bunch of amused giggles and incredulous looks from the others. However, the teacher knows that no one's going to abstain, so, to emphasis safe sex, she passes a box of condoms around, much to Mike's horror. Stan grabs a handful. Mike says he doesn't need any because he'll only have sex with the girl he loves. And sex should be had by married people, to have kids. Forgetting himself, as he describes the joy of having a baby, the other girls are touched. They return the condoms immediately. Stan grabs more and forcibly kisses Maggie. Infuriated, Mike launches himself at Stan and the two fight, with Mike getting beat down. The fight is captured on videophones and sent around the whole school. A humiliated Mike is called to the principal's office along with his "dad", Ned, who comes dressed to impress (or so he thinks). In Jane's office, he tries his crazy "seduction technique", but Jane blows him off.
He goes to Scarlett's place and sees her in the yard, preparing to do some gardening in the backyard. She leads him into the backyard and tells him what she plans to do to fix it up. Unwittingly, he calls her "Scar" and she catches on to it. He volunteers to help her out. A montage follows - Mike trains Alex for basketball, helps Scarlett with the garden, tries to keep Maggie away from Stan, while Ned keeps flirting with Jane.
After the tryouts, Mike and Alex are both selected for the team. Scarlett is thrilled to hear the news. She shows them the finished backyard - it looks great. Mike compliments her profusely and tells her to start a business. She's flattered. She tells him that she's going out on a date, which involves dancing. He sees her dancing in front of a mirror. He asks her to teach him. They start to dance pretty well. He asks about her husband, if they'll ever get back together. She's pretty sure they won't. They're interrupted by Alex, who's a bit weirded out seeing them dance. He tells them her date's here. Her date is Mike's former boss, Dean. Mike is pissed and tries to talk Scarlett out of it, but she goes anyway. Just as they drive off, Stan rolls by to pick up Maggie for a party. Dragging Alex along, Mike goes to the party.
The party is at a bowling alley. Alex is scared to be there, but Mike tells him he's part of the basketball team. They see Nicole and Alex tries to bolt, but Mike stops him. He tells him he's not a loser. He pushes Alex to go talk to Nicole. As he looks for Maggie, he gets waylaid by three of Maggie's friends - Jaime, Samantha and Lauren. They try to seduce him, but he sits them down and tries to talk some sense in them, but it's like talking to the walls. He walks away, muttering it's some other dads' problems. As Alex awkwardly and nervously talks to Nicole, he gets too close to a candle and his pant leg catches on fire. He races to the restroom. Mike finds Maggie and sits next to her. He asks her what she sees in Stan. She dismissively tells him that she and Stan are going to move in together after high school. He's going to work in Home Depot, while she attends Community College to be closer to him. Mike refuses to let that happen. He angrily forbids her to see Stan. She gets mad and walks off.
The next day, a basketball game is underway. Scarlett is in the audience with Dean. Hayden High is a few points behind. Mike sees Stan making out with Maggie and gets mad. With seconds left in the game, Mike finds himself deciding whether to pass to Stan (who's unguarded and close to the next) or Alex (who's in the 3-pointer zone). He chooses Alex, who scores! Hayden wins! Everyone celebrates, though Stan is pissed. Nicole congratulates Alex, though his nervousness almost ruins the moment. After the game, Ned corners Principal Jane and asks her out to dinner. After some persuasion, she agrees, though she doesn't want any flashy stuff from Ned. To help Alex with Nicole, Mike announces a party at his (read, Ned's) place. He sees Maggie crying and goes to her. She tearfully says that Stan dumped her, because she refused to have sex with her. Greatly relieved, he consoles her. However, she misreads his fatherly advice and tries to kiss him, but he dodges her and sidesteps, inviting her to the party. Soon, word spreads throughout the school about the party.
At Ned's place, the party is underway. Mike sees Alex finally hit it off with Nicole. At a fancy restaurant, Ned tries to act refined in front of Jane, but blows it. He confesses he's a dork. However, she proves that she's just as big a nerd as he is, by quoting "Lord of the Rings". Seems like the beginning of a beautiful geeky friendship. At the party, Stan drunkenly tries to apologize to Maggie. But she blows him off and tells him she's with someone else. Mike shows up and tells him to leave, before he calls the cops. Stan insults Maggie, inciting Mike to swing at him. He misses, but Stan connects, knocking Mike out.
When he wakes up, he finds his head on Maggie's lap, while she caresses him. He recoils immediately, but she pounces, thinking it to be a game. He tells her he has another girlfriend to keep her off. Accepting it, she leaves. At the restaurant, Ned and Jane converse in Elf-tongue, culminating in her asking him "your lair or mine". Check please! At the party, it seems to be going a bit out of control, with kids playing around with Ned's most treasured possessions. Scarlett shows up, looking for Alex. Mike tells her that Alex has a girlfriend and he'll take her to them. When Ned shows up at home, he's fuming to see his home a mess. He throws everyone out, with some help from Principal Jane. Scarlett and Mike watch Alex and Nicole kiss. She's thrilled and grateful to Mike for being a good role model. As they talk, he suddenly kisses her, as Maggie and her friends watch in astonishment. Scarlett slaps him in outrage and storms off. He chases after her, confessing that he's not "Mark", but her husband and the father of her kids. That sets her off and she yells at him and walks off. Maggie walks up, calls him a pervert and slaps him, followed by Samantha, Lauren and Jaime. Jane tells Ned that this is why she doesn't date students' parents and walks away. Mike apologizes to Ned. Ned slaps him a few times and calls it even.
The next morning, Ned cleans up the mess from the party, while Mike moans about his screw-up. He has to appear in court for the divorce proceedings. Using a police siren, Ned drives him there in his convertible. At the courthouse, Ned barges into the courtroom, acting as a lawyer. However, the judge orders the bailiffs to remove him and Mike from the courtroom. Mike yells out that he has a letter from Mike O'Donnell. Scarlett asks to hear it. Mike reads the letter. He tearfully recalls the time he met Scarlett, and how much he loves her. He apologizes for blaming her for his failures. He doesn't want to divorce her, but he loves her and wants her to move on. Scarlett emotionally listens. The judge orders him to leave, now that he's done. Leaving the paper behind, he walks out. Scarlett watches as he walks out and then asks the judge to postpone the hearing. When she looks at the paper, she sees it only contains directions. And now she starts to understand.
At Ned's place, as Mike shoots hoops, he tells Ned that his family is better without him. He can move on. At Scarlett's house, she looks through their high school yearbook at Mike's 1989 picture. She sees a wedding band and a note on the hammock. It's from Mike, apologizing for not finishing what he started. They go to the game.
At the basketball court, similar to the first scene, as Mike dunks basket after basket, Coach Murphy approaches and tells him about a scout coming in and Mike being a shoo-in. A picture of the team is taken. The game is about to begin. Scarlett and Maggie enter. Maggie tells her mother that she plans to go to Georgetown. Ned approaches Jane and tells her he wants to be friends. Some geek-talk follows and it looks like they're back together.
The game starts. Just as it starts, Mike makes the same special shooting pose for Scarlett (similar to the beginning of the movie). Now understanding fully, Scarlett gets up and starts to walk out. And a similar situation like in the start of the movie develops. He sees her near the rafters, about to walk out. The coach, the crowd, the scout, everything as before. He makes up his mind. He gives the ball to Alex and runs out. As he does, the janitor (his Spirit Guard) watches and smiles. Alex is put into the game. Mike runs after Scarlett. As he does, his vision starts to wave and then... a flash. He runs to the door. Scarlett appears and asks if it's him. It's Mike (the Matthew Perry lookalike), her husband. He tells her that he loves her and wants to be with her. He promises to make it up to her. She forgives him and kisses him.
Thanks to Alex, Hayden High wins the game. Mike and Scarlett walk out, reminiscing about Mike's "six-pack", when he was younger.
During the credits, Mike goes to Ned's bedroom to thank him and finds Principal Jane under the sheets. Both she and Ned are wearing Mr. Spock ears. Mike is now the coach, since Coach Murphy retired after 20 years. Ned gifts him a new whistle.
As the credits roll, we see yearbook pictures of people involved in making the movie.