Madagascar: Escape 2 Africa

As a cub, Alex the Lion was called Alakay and was the son of Zuba, the alpha lion. Though Zuba tries to teach Alakay to be a hunter, the cub is more interested in dancing, and is captured by poachers when Makunga, Zuba's rival, challenges Zuba to a fight for the position of alpha lion. Alakay is forced into a crate, and taken away despite Zuba's attempts to rescue him. The crate falls into the ocean where it drifts to New York. There, Alakay is renamed Alex and sent to the Central Park Zoo where he grew up, meeting Marty the Zebra, Melman the Giraffe, and Gloria the Hippopotamus. Most of the events of the first film are then described through a series of news flashes.
In the present time, Alex the Lion, Marty the Zebra, Melman the Giraffe, Gloria the Hippopotamus, the Penguins Skipper, Kowalski, Private, and Rico, the Chimpanzees Mason and Phil, and even the Lemurs King Julien, Maurice, and Mort board a repaired airplane to fly back to New York. The plane takes off, but crash-lands in continental Africa. In Africa the animals are amazed to find more of their kind. Alex is reunited with Zuba and his mother. Marty fits in with a herd of zebra who all look and sound exactly like him. Hypochondriac Melman becomes a witch doctor. Gloria attracts the attention of a smooth-talking hippo named Moto Moto.
Meanwhile, the penguins set about repairing the plane. They carjack several jeeps under "Operation Tourist Trap", leaving the tourists stranded in the jungle. Nana, a tough old woman known for beating up Alex in the first film, takes charge of the group.
Unfortunately, life in Africa is not as wonderful as it first seemed. Makunga, still determined to take the position of alpha lion, reminds Zuba that Alex must complete a traditional coming-of-age challenge that he did not complete. Alex, thinking that the challenge is a dance contest (it is actually a fight) competes against the strongest lion, Teetsi who was recommended by Makunga and loses quickly. To avoid banishing his own son for failing, Zuba relinquishes his title as Alpha lion. Makunga immediately takes the position and ousts Alex and his family. Marty, meanwhile, begins to feel upset because there is nothing unique about him. Melman is happy until he learns that he has the same symptoms that apparently caused the previous witch doctor to die. Melman is also forlorn about Gloria dating Moto Moto, as Melman has secretly loved her for a long time. Gloria goes on a date with Moto Moto and quickly realizes that he only loves her for her large body.
The next day, the animals panic when the watering hole dries up. Determined to make up for his earlier failure, Alex and Marty leave the reserve to investigate. They discover that the stranded New Yorkers, under the instruction of Nana, have dammed up the river and built a primitive civilization. Alex is captured by a trap, forcing Marty to abandon him to seek help. Meanwhile, Zuba hears from Makunga what Alex did and goes to assist him.
Back on the reserve, King Julien (who proclaims himself king upon arriving in Africa) suggests that the animals offer a sacrifice in the volcano, Mount Kilimanjaro, to appease the water gods. Believing that he will die soon, Melman volunteers to be sacrificed. Gloria stops him just in time and Marty arrives to tell them about Alex. The trio, the penguins, and several chimpanzees use the newly fixed plane to execute a rescue.
However, Alex has already managed to rescue both himself and his father by dancing for the New Yorkers, who fondly remember him from the zoo. The other animals arrive to pick them up with the plane (redesigned as a helicopter), and together they all destroy the dam, freeing the water.
Meanwhile, back at the volcano, Mort turns up after being chased through the jungle by a shark. The shark falls into the volcano, completing the sacrifice and causing King Julien to think that he brought back the water.
As the watering hole fills, Makunga angrily makes a stand for control. However, Alex manages to remove Makunga from power by tricking Nana into attacking him. Zuba gives the alpha position to Alex, but Alex refuses, resulting in both father and son becoming co-leaders.
The movie ends as Skipper marries a bobble-head hula doll from the plane and leaves on a honeymoon in Monte Carlo with the chimpanzees, and a huge tub of diamonds and gold, leaving Alex, Marty, Melman, Gloria and The Lemurs to happily remain in Africa with Alex's parents.

Question: How did alex rescue himself?
Answer: Dancing for the new Yorkers