In 1883, the Boston company that owns the merchant sailing ship Gerrymander gives her captain, Captain Boll, six months to show a profit in the Netherlands East Indies. Facing both pirates and a Dutch policy that bars foreigners from carrying goods between ports, Boll seeks another path to wealth. On Java, an Indonesian man whose life Boll once saved tells him that native divers have salvaged a fortune in diamonds from the sunken Pieterzoon, and he sends Boll to a Chinese junk captain with a captive, the dancer Kim Kim. She knows where the diamonds lie.
Boll violates Dutch anti-slavery laws by buying Kim Kim and smuggling her aboard the Gerrymander. Flint, the ship's first mate, learns why Boll purchased her and threatens to turn him over to the Dutch unless he is given half the diamonds.
A notorious pirate posing as a naturalized Dutch citizen — known as Saint Ebenezer but truly Pulo Besar — learns that Kim Kim is aboard and alerts the Dutch authorities. They search but do not find her, as she hides on deck inside a half-filled water cask. When the crew discovers her, Boll insists she be treated as a passenger; later, he must fight one of the sailors to defend her honor.
Boll presses Kim Kim for the diamonds. He reveals that his dream is to own his own ship; she replies that the diamonds lie on Vishnu's island. Meanwhile, Flint stirs the crew against Boll, arguing that Kim Kim's presence has unsettled their captain. When the mutiny comes, Boll offers the crew Flint's half of the treasure if they depose him; they agree, the mutiny ends, and Flint is jailed. Gerrymander sets course for Vishnu's island. Boll and Kim Kim begin a romance during the voyage, but she worries that Vishnu would be angered if Boll takes the diamonds.
Beside pirates attack and seize Gerrymander, bringing the crew to Besar's island, where a palace and an army await. To force Kim Kim to reveal the diamonds, Besar has her flogged, and also parades her mother, a longtime prisoner, in front of her to break her will. Loyal to Boll, Kim Kim refuses to betray him. Besar instead threatens to kill Boll, and she agrees to cooperate to save him; Flint, Wilson, and another sailor join the plan.
Besar, his pirates, Kim Kim, Flint, and Wilson head for Vishnu's island. The Gerrymander's crew escape and retake their ship, setting off in pursuit. To stay ahead of a looming moonless night, Boll and two of his men row in a black-sailed longboat, signaling back to the Gerrymander. Wilson dives overboard to join them after overhearing the pirates' location, and he provides crucial intelligence that identifies Vishnu's island as Krakatoa.
Besar's ship and the Gerrymander reach Krakatoa just as the volcano rumbles to life. Pirates race ashore to reach Vishnu's temple near the rim, while Boll spots Kim Kim on the shore below. The eruption intensifies, and Boll decides it is too dangerous to linger; he orders a rescue for Kim Kim and pulls away toward the sea. Besar's faction makes it to the temple but is wiped out by the eruption, while the remaining pirates flee.
As Krakatoa erupts, destroying the island and closing the chance to recover the diamonds, Boll announces a bounty of 100,000 guilders on Besar and secures a plan to hand Besar's island over to the Dutch. On Gerrymander's quarterdeck, Boll marries Kim Kim, sealing his fortunes as his crew looks on.