Upon moving to New Mexico after winter vacation ends, Gabriella is surprised to find that the school she has just transferred to, East High School, is the same school Troy attends. In an attempt to confirm her identity, Troy calls her phone during homeroom, getting them both detention but verifying that the girl he thought he recognized is actually her. They continue their friendship at East High despite being in different social circles (Troy is a jock and Gabriella has been adopted by the school's brainiacs). Troy shows Gabriella around the school, and they notice the sign-up sheet for the school musical. Thanks to their previous singing experience at the New Year's Eve Party, they both internally debate auditioning.
They sneak into the auditions later and are surprised to see each other there. They remain together in hiding while Ryan and Sharpay, the school's brother-and-sister team of drama royalty, audition. Rather suddenly, Gabriella emerges from her hiding spot and asks to audition, and Troy abruptly jumps up and volunteers to be her partner. After being told that they are too late, they help Kelsi, the pianist, pick up her things. She plays them the song What I've Been Looking For (Reprise), which Troy and Gabriella then sing together. Ms. Darbus, the theatre teacher, hears them singing, and gives them a callback audition. Once everybody in school learns that they are singing together, both Troy and Gabriella receive pressure from their friends to forget about singing.
When Sharpay discovers that Troy, a jock (who's her crush), and Gabriella, a nerd, have a shot at being leads in the school play, she is enraged, and attempts to rally the student body around the idea that no one should do anything outside the realm of his or her clique. After the rest of the school find out about Troy and Gabriella auditioning, people start admitting secret hobbies and breaking the status quo. This causes all the students in the cafeteria to start sing Stick to the Status Quo. Troy leaves a note in Gabriella's locker, so she will meet up with him on the rooftop. On the rooftop, Troy and Gabriella talk and Gabriella tells Troy that sing with him felt "just like kindergarten".
Troy and Gabriella decide to do the callback despite the resistance they are facing, so their friends resort to tricking them out of it so they are more focused on "important things", such as the 'big game' and the scholastic decathlon. Gabriella is called into the science room to watch a video of an unknowningly filmed Troy lying to his friends about how the callbacks aren't important to him. Upon hearing this, Gabriella is devastated and comes to the conclusion that things between she and Troy were never meant to work out. She then sings When There Was Me and You, in which Gabriella indicates she has feelings for Troy that run deeper than friendship. Completely crushed, Gabriella tells Troy that they won't be doing the callback. She is obviously upset, something even her friends notice, and acts very withdrawn, totally unaware that Troy is acting the same way.
Eventually, Chad and Taylor (the ringleaders of Troy and Gabriella's respective cliques) realize their mistake has made their friends extremely unhappy and eventually tell them both the truth. Taylor hints at Gabriella's feelings for Troy, saying that what really matters is how she feels about her friends "and even more... Troy." Unfortunately, Gabriella is too hurt to believe them and continues to avoid Troy. Chad, Zeke, and Jason find Troy on the rooftop garden and tell him that they know why Gabriella won't speak to him, prompting him to go apologize for what he said. However, when he arrives at her house to apologize, Gabriella asks her mom to tell him that she's busy with "homework and such." In a desperate attempt to win her over, Troy calls her and Gabriella listens as he explains what happened. He climbs onto her balcony with their sheet music, and after he sings Start of Something New (Reprise) to her, she forgives him. The two seem to become closer than ever after this.
At school, Troy and Gabriella discover that the callback dates have been changed by Sharpay and Ryan to overlap with both the basketball game and the scholastic decathlon, meaning that they would have to chose which event to attend -- sing together or compete with their respective teams. After setting off odorous chemicals and messing with the lighting in the gym, Troy and Gabriella find a way to do all three events. However, stage fright returns to Gabriella as the whole school files into the auditorium to watch her auditon with Troy, who is able to break through her shyness by reminding her that it was "just like kindergarten" and to just "look right at him." After singing Breaking Free, Troy presses a kiss to Gabriella's cheek and she giggles, blushing. Troy and Gabriella end up winning the callback.
What Time Is It? (Summer Time). Troy and Gabriella meet up at Gabriella's locker and Troy gives Gabriella a 'T' (which stands for Troy) necklace. Troy and Gabriella then almost kiss, but are interrupted by a student who wants Troy to sign his yearbook. Troy promises to teach her how to skateboard, and Gabriella giggles that she has first aid training to patch herself up afterwards. However, their plans change slightly when Troy is offered a job at Lava Springs (courtesy of Sharpay's scheming) and brings Gabriella along to lifeguard. The rest of the Wildcats work in the kitchen.
Later on, the Wildcats win the basketball championship game and Gabriella's team wins the scholastic decathlon. Troy nearly gets a kiss from Gabriella, only to be interrupted by Chad and then, moments later, Taylor. Everyone then starts to dance and sing We're All In This Together. The movie ends with the pair on more than friendly terms.
Troy and Gabriella go on a picnic on the golf course, playing around and nearly sharing a kiss before being interrupted by sprinklers that were activated by a spying Sharpay. They also sing a song that Kelsi has written You Are the Music in Me with hopes of them entering the country club's Star Dazzle talent show. As time goes on, Sharpay develops her plan to pull Troy away from Gabriella—and his friends—by promoting him to a golf job where she takes lessons and monopolizing his time. She also manages to trick him into promising to sing with her You Are the Music In Me (Sharpay Version). Gabriella becomes slightly jealous and Taylor begins insisting that Troy is behaving inappropriately according to her (Taylor's) sister's "boyfriend rules".
As times goes on, Troy begins to spend more time with Sharpay, coming late to, or even skipping, dates with Gabriella. Once Troy begins ignoring his friends and Sharpay, in her plans grand finale, bans all working Wildcats -- not including 'honorary member' Troy -- from the talent show, Gabriella tells Sharpay that she has had enough. Gabriella sings Gotta Go My Own Way to Troy. Gabriella gives Troy back the T-necklace that he gave her. She leaves Lava Springs, breaking up with Troy and leaving him stunned and brokenhearted . With absence, his friends' indifference towards him becomes glaringly obvious and he realizes that he need to make some changes. He tells off Sharpay and returns to his old kitchen job, attempting to win forgiveness from his friends. However, Gabriella is still out of the picture.
The night of the Star Dazzle talent show, Troy agrees to sing with Sharpay if she will let the Wildcats do the show. Depressed, Sharpay tells him that she wishes he was doing this for her and not for his friends. He only smiles sadly, knowing that he's dedicated to Gabriella. His friends drag him away to teach him the new song that Sharpay wants to sing. An uncomfortable Troy goes up on stage alone, waiting for Sharpay to come sing with him. However, Sharpay doesn't know the song he was just taught and cannot go join him to sing. Troy starts to sing Everyday and then hears Gabriella's voice accompanying him, and learns that Taylor had gone to get her from home, returning the T-necklace he gave her to its proper place around her neck.
She forgives him for everything that has happened and the two realize that they should be seizing the day. Later, all the Wildcats go to watch the fireworks on the golf course and, as their friends dance around in the sprinklers, Troy and Gabriella share their first kiss, boyfriend and girlfriend once again.
Towards the end of their senior year, Troy and Gabriella are still dating and are very serious about their relationship. During the championship game against West High, Troy looks to Gabriella for support and she encourages him to keep trying and, ultimately, to win. This all happens while they sing Now Or Never. Later, at the celebration at Troy's house, Gabriella and Troy hang out in his tree house and discuss their futures, namely the fact that Gabriella has already been accepted by Stanford University while Troy is being pushed towards U of A, two schools that are 1,053 miles from each other. Both teens are clearly uncomfortable with the idea of such a long distance separating them, and decide to focus on the present for the moment. They then sing Right Here, Right Now.
The Wildcats are later recruited to help with the school musical, Senior Year, and Gabriella mentions the idea of staging the perfect prom. Later, on the rooftop, Troy asks her to go to prom with him, both teens admitting that it is the first time they will be attending a dance together or alone, and Gabriella teaches him how to waltz while they sing Can I Have This Dance? They nearly share a kiss in the rain but are interrupted by the school bell ringing. Their relationship develops as they practice for the musical by singing A Night To Remember and Just Want To Be With You, and Troy admits that he's been talking to schools other than U of A. Gabriella also admits that she has some decisions left to make, but her mother cuts her off before she can tell Troy what she means. Gabriella learns that she has been accepted into Stanford's 'Freshmen Honors Program' and would be leaving two weeks early, missing prom, the show, and graduation. Taylor encourages her to go, but Gabriella claims that she has been considering staying in Albuquerque, obviously in order to stay closer to Troy at U of A. When Troy learns about this, from a sneaky Sharpay, he sneaks into her room with a picnic and insists that should go because she "can't put off something as great as Stanford." Although Troy's insistence does ultimately convince her to go, she finds that it is too hard for her to say goodbye and leaves without a word, planning to return for prom, the show, and graduation.
After two weeks apart, Gabriella makes a phone call to Troy and tells him that she won't be coming back because she can't handle having to say goodbye to her friends and, more importantly, him, again. She admits that she loves him (the first time it's said by either of them), but hangs up without giving him a chance to reply. She is later surprised when Troy shows up at Stanford on the night of prom back in Albuquerque. He explains that "if [he's] going to have a last dance at East High, it's going to be with [her]" and manages to convince her to come back to East High with him for the show and graduation by singing Can I Have This Dance? (Reprise). At the end of 'Senior Year', Troy reveals that he's made the decision to attend UC Berkeley to study both basketball and theater, a school that is only 32.7 miles away from "the person who inspires his heart." Gabriella is extremely touched by this, and, after graduating, the two head off to college, still together.
Troy: But seriously, you have an amazing voice. You're a singer, right?
Gabriella: Just church choir is all. I tried to a solo and nearly fainted.
Troy: Really? Why's that?
Gabriella: I took one look at all the people staring at me and next thing I knew I was staring at the ceiling. End of solo career.
Troy: Well with the way you sang tonight, that's pretty hard to believe.
Gabriella: Well that was the first time I've done something like that. I mean, it was so cool!
Troy: I know! Completely!
Gabriella: Well you sounded like you've done alot singing, too.
Troy: Yeah sure. My shower had it's variables.