Given the operetta's mockery of the "Queen's Navee" and the aristocracy in general, it is perhaps unsurprising that its initial reception was somewhat cool. Queen Victoria is said to have summed up her reaction to the performance with the famous phrase, "We are not amused". Gilbert was to insert a backhanded sort of apology in his next work, The Pirates of Penzance, in which he mentions "That infernal nonsense Pinafore."
Warning: Wikipedia contains spoilers
The opera opens with a view of the main characters on the ship deck. Mrs Cripps, a Portsmouth "bumboat woman" (dockside vendor) nicknamed Little Buttercup, comes on board and has an interview with the villainous Dick Deadeye, and Ralph Rackstraw, "the smartest lad in all the fleet," who is in love with Josephine, Captain Corcoran's daughter. The Captain appears on deck, upset because Josephine will not accept the suit of the noble Sir Joseph Porter, K. C. B. and "Ruler of the Queen's Navee". Josephine confesses to her father that she loves a common sailor, although for the sake of her rank she will carry her love to the grave without letting him know of it. Sir Joseph comes on board (with a chorus of sisters, cousins, and aunts) and proposes to Josephine, who insists she cannot love him. Shortly afterwards she meets Ralph, who declares his love for her, only to meet with a haughty rejection. However, when he draws his pistol and threatens suicide, she admits she loves him. The two plan to sneak ashore at night to be married, but Dick Deadeye overhears the plot and decides to thwart it.
The second act opens at night, with Captain Corcoran sadly telling his troubles to the moon. Little Buttercup offers sympathy and moves to an offer of more affection, but he informs her he can only be her friend. Angrily, she makes a vague prophecy of changes in store. Sir Joseph enters, and complains of his disappointment at his reception from Josephine. The Captain replies that she is probably dazzled by his rank, and that if he can convince her that "love levels all ranks," everything will be all right. When Sir Joseph makes this argument, however, he unwittingly pleads his rival's cause. Josephine tells him she has hesitated, but now has made up her mind. Sir Joseph and the Captain are rejoicing over this apparent change of heart, when Dick Deadeye interrupts to reveal the truth -- that Josephine and Ralph plan to elope that night.
The Captain confronts the lovers as they try to leave the ship, and insists upon knowing what Josephine plans to do. Ralph steps forward to announce his love, which causes the furious Captain to let slip an obscenity. This is overheard by the prudish Sir Joseph, who orders him to his cabin. He then inquires of Ralph what he has done to make the Captain swear. Ralph replies that it was his declaration of love for Josephine. Furious in his turn at this revelation, Sir Joseph orders Ralph's imprisonment. When he starts to chide Josephine for the mismatch, however, Little Buttercup steps forward to reveal her secret. Years before, when she was practising baby-farming, she nursed two babies, one of "low condition," the other "a regular patrician," and she "mixed those children up and not a creature knew it... The wellborn babe was Ralph; your Captain was the other." Sir Joseph summons both and orders them to change places, giving Ralph the command of the Pinafore. As his marriage with Josephine is now impossible ( "...love levels all ranks,"... "Yes, but it doesn't level them that far."), he gives her to now-Captain Ralph. Corcoran, now a common seaman, is now able to marry the lowly Little Buttercup, so all ends happily.
Popular songs include Sir Joseph's solo, "I am the Monarch of the Sea", a brazen satire on the career of W H Smith, the newsagent who had risen to the position of First Lord of the Admiralty in 1877. However, in a live performance, it is Never Mind the Why and Wherefore, a trio by the Captain, Josephine, and Sir Joseph, which is often subject to two or three encores.