The Swiss-made Solar Impulse landed in Ouarzazate at 26 minutes after midnight (2326 GMT) after having taken off from Rabat at dawn on Thursday.
"Once again, the flight was magnificent," pilot Andre Borschberg said shortly before landing.
Earlier, during the flight, Borschberg told AFP by satellite telephone from his cockpit said he was optimistic about the chances of success.
"The sky is magnificently beautiful and I am pretty confident of arriving at the destination," pilot Andre Borschberg said.
"I can see far away the Moroccan coast in a superb blue... Today everything seems possible. In Ouarzazate, the weather forecast is good," he added.
"Mother Nature seems to be more favourable than the last time."
When Borschberg made his first attempt to cross the desert on June 13th, he had to turn round because of strong winds and turbulence near the Atlas mountains.
This was the final stage of a trip that has taken him from his native Switzerland to Spain and then to Morocco.
Earlier this month, fellow inventor and adventurer Bertrand Piccard -- who made the first non-stop around-the-world balloon flight 13 years ago -- flew Solar Impulse from Madrid to Rabat.
It was the first-ever flight between two continents by an aircraft that does not require a single drop of fuel.
"Our journey shows that there are other ways of saving energy and of saving the environment and the planet," Borschberg told AFP from the cockpit of his plane, which looks like a giant glider.
At one point, about half-way into the final and toughest leg of the solar plane's trip, the craft was flying over the Atlantic towards the port city of Casablanca at a speed of about 62 kilometres per hour (38.6 mph).
Friday's landing point, Ouarzazate, is where the Moroccan authorities plan to build the largest solar power station in the world.
Speaking of his foiled bid the previous week, Borschberg said people "should not talk of failure, but of experience. It's training, you learn a lot of things."
The flight was described as the most challenging Solar Impulse has yet faced because of the arid, baking hot nature of the terrain and the proximity of the mountains, which are more than 3,000 metres high.
The giant high-tech aircraft, which has the wingspan of a jumbo jet but weighs no more than a medium-sized car, is fitted with 12,000 solar cells feeding four electric motors driving propellors.
Ouarzazate is 550 kilometres from the Moroccan capital. The flight took more than 17 and a half hours, slightly more than the 16 hours they had estimated.
But the prototype aircraft has a slow speed and was to some extent at the mercy of the unpredictable climate.
The flight has been jointly organised by the Swiss Solar Impulse company and the Moroccan agency for solar energy (Masen).
Masen is responsible for building a power station with an initial capacity of 160 megawatts and plans to raise this capacity to about 500 MW to 2015.
Last month, the solar-powered plane made the 2,500-kilometre journey from Madrid to Rabat, its longest to date and its first between continents, after an inaugural flight to Paris and Brussels last year.
The flights are intended as a rehearsal for the goal of a round-the-world trip in 2014 by an updated version of the plane.