In Salzburg, Austria, just before World War II, nuns from Nonnberg Abbey sing the Dixit Dominus. One of the postulants, Maria Rainer, is on the nearby mountainside, regretting leaving the beautiful hills ("The Sound of Music") where she was brought up. She returns late. The Mother Abbess and the other nuns consider what to do about her ("Maria"). Maria explains her lateness, saying she was raised on that mountain, and apologizes for singing in the garden without permission. The Mother Abbess joins her in song ("My Favorite Things"). The Mother Abbess tells her that she should spend some time outside the abbey to decide whether she is ready for the monastic life. She will act as the governess to the seven children of a widower, Austro-Hungarian Navy submarine Captain Georg von Trapp.
Maria arrives at the villa of Captain von Trapp. He explains her duties and summons the children with a boatswain's call. They march in, clad in uniforms. He teaches her their individual signals on the call, but she openly disapproves of this militaristic approach. Alone with them, she breaks through their wariness and teaches them the basics of music ("Do-Re-Mi").
Rolf, a young messenger, delivers a telegram and then meets with the oldest child, Liesl, outside the villa. He claims he knows what is right for her because he is a year older than she ("Sixteen Going on Seventeen"). They kiss, and he runs off, leaving her screaming with joy. Meanwhile, the housekeeper, Frau Schmidt, gives Maria material to make new clothes, as she had given all her possessions to the poor. She sees Liesl slipping in through the window, wet from a sudden thunderstorm, but agrees to keep her secret. The other children are frightened by the storm. Maria sings "The Lonely Goatherd" to distract them.
Captain von Trapp arrives a month later with Elsa Schräder and Max Detweiler. Elsa tells Max that something is preventing the Captain from marrying her. He opines that only poor people have the time for great romances ("How Can Love Survive"). Rolf enters, looking for Liesl, and greets them with "Heil". The Captain orders him away, saying that he is Austrian, not German. Maria and the children leapfrog in, wearing playclothes that she made from old drapes. Infuriated, the Captain sends them off to change. She tells him that they need him to love them, and he angrily orders her back to the abbey. As she apologizes, they hear the children singing "The Sound of Music", which she had taught them, to welcome Elsa Schräder. He joins in and embraces them. Alone with Maria, he asks her to stay, thanking her for bringing music back into his house. Elsa is suspicious of her until she explains that she will be returning to the abbey in September.
The Captain gives a party to introduce Elsa, and guests argue over the Anschluss. Kurt asks Maria to teach him to dance the Ländler. When he is unable to negotiate a complicated figure, the Captain steps in to demonstrate. He and Maria dance until they come face-to-face; and she breaks away, embarrassed and confused. Discussing the expected marriage between Elsa and the Captain, Brigitta tells Maria that she thinks Maria and the Captain are really in love with each other. Elsa asks the Captain to allow the children say goodnight to the guests with a song, "So Long, Farewell". Max is amazed at their talent and wants them for the Kaltzberg Festival, which he is organizing. The guests leave for the dining room, and Maria slips out the front door with her luggage.
At the abbey, Maria says that she is ready to take her monastic vows; but the Mother Abbess realizes that she is running away from her feelings. She tells her to face the Captain and discover if they love each other, and tells her to search for and find the life she was meant to live ("Climb Ev'ry Mountain").
Max teaches the children how to sing on stage. When the Captain tries to lead them, they complain that he is not doing it as Maria did. He tells them that he has asked Elsa to marry him. They try to cheer themselves up by singing "My Favorite Things" but are unsuccessful until they hear Maria singing on her way to rejoin them. Learning of the wedding plans, she decides to stay only until the Captain can arrange for another governess. Max and Elsa argue with him about the imminent Anschluss, trying to convince him that it is inevitable ("No Way to Stop It"). When he refuses to compromise, Elsa breaks off the engagement. Alone, the Captain and Maria finally admit their love, desiring only to be "An Ordinary Couple". As they marry, the nuns reprise "Maria" against the wedding processional.
During the honeymoon, Max prepares the children to perform at the Kaltzberg Festival. Herr Zeller, the Gauleiter, demands to know why they are not flying the flag of the Third Reich now that the Anschluss has occurred. The Captain and Maria return early from their honeymoon before the Festival. In view of developments, he refuses to allow the children to sing. Max argues that they would sing for Austria, but the Captain points out that it no longer exists. Maria and Liesl discuss romantic love; Maria predicts that in a few years Liesl will be married ("Sixteen Going on Seventeen (Reprise)"). Rolf enters with a telegram that offers the Captain a commission in the German Navy, and Liesl is upset to discover that Rolf is now a committed Nazi. The Captain consults Maria and decides that they must secretly flee Austria. German Admiral von Schreiber arrives to find out why Captain Von Trapp has not answered the telegram. He explains that the German Navy holds him in high regard, offers him the commission, and tells him to report immediately to Bremerhaven to assume command. Maria says that he cannot leave immediately, as they are all singing in the Festival concert; and the Admiral agrees to wait.
At the concert, after the von Trapps sing an elaborate reprise of "Do-Re-Mi", Max brings out the Captain's guitar. Captain von Trapp sings "Edelweiss", as a goodbye to his homeland, while using Austria's national flower as a symbol to declare his loyalty to the country. Max asks for an encore and announces that this is the von Trapp family's last chance to sing together, as the honor guard waits to escort the Captain to his new command. While the judges decide on the prizes, the von Trapps sing "So Long, Farewell", leaving the stage in small groups. Max then announces the runners-up, stalling as much as possible. When he announces that the first prize goes to the von Trapps and they do not appear, the Nazis start a search. The family hides at the Abbey, and Sister Margaretta tells them that the borders have been closed. The Nazis do not find them until Rolf comes upon them. He calls his lieutenant; but, upon seeing Liesl hiding, he reports that he has found no one. To help them flee, the nuns have secretly sabotaged the cars of the Nazis. The von Trapps flee over the Alps as the nuns reprise "Climb Ev'ry Mountain".
(Mary Martin, Theodore Bikel, cast--Broadway 1959)