Lina Mayfleet and Doon Harrow had found the way to escape the dying underground city of Ember. They sent a message down to the people below, hoping it would be found and others would find the way out. After a long day of waiting, their wish comes true. Four hundred refugees from the city manage to escape before the electricity shuts off and leaves them in the dark. But the people have never lived above ground, in the sunshine. Although technologically advanced, they have no knowledge of how to live on the surface of the earth.
Their search for civilization ends when they find the town of Sparks. This agricultural community has made it through some hard times and is now enjoying a time of relative prosperity. Its leaders, Mary Waters, Ben Barlow and William Dent, agree to let the people of Ember live among the community for six months. During that time, the people of Sparks will try to teach them about farming, weather and other skills they will need in order to survive on their own.
Most of the refugees are sent to live in an abandoned hotel on the edge of town. Although its furniture has long been scavenged, it provides shelter from the sunlight and rain, something to which the Emberites must try to become accustomed. Lina, her guardian, Mrs. Murdo, and her sister, Poppy, are sent to live with Dr. Hester because Poppy is very sick.
The doctor is friendly but scatterbrained. Her young nephew, Torren, also lives with her. He is unhappy about having to give up his bedroom to strangers.
Doon is excited to learn all about this new world. He loves to see the animals, like oxen and dogs, and learn about trees and sunshine. He is surprised to learn that the earth is a sphere and that there are no boundaries to stop him from exploring.
The refugees are assigned to various Sparks families during the day. They help the families farm, clean and build so that they can learn the skills they will need to survive. In exchange for their work, the families bring the Emberites into their houses and feed them lunch. In the evening, they are given food to bring to the hotel to eat for supper and breakfast.
Torren teaches Lina about three plagues and four wars. Many years earlier, people had learned how to fly and make music that came out of the air. They had moving pictures and paved roads. Then people began to fight about whose god was better and who should have the most land. They built guns and bombs that could kill whole cities.
After the wars came the plagues — one of starvation, one of fever and the last a respiratory disease. Together, the three plagues and four wars are called the Disaster. It killed off most of the people so that the few survivors had to learn to live all over again, without the convenience of electricity and gasoline.
In present time, tensions begin to rise between the people of Ember and those of Sparks. As summer approaches and the weather gets hotter, many Emberites get headaches, sunburns and heatstroke. The people from Sparks think those from Ember are weak and lazy. The families who sponsor the refugees resent having to share their food. Soon, the portions for the Emberites become smaller at lunch and even less for breakfast and dinner.
Often, the Emberites look foolish because they are afraid of animals, like chickens, or they do not know about storms or fire. Some in Sparks still welcome the refugees. Kenny, a younger Sparks boy, befriends Doon and shows him an abandoned library. Doon takes books home so he can learn about the world.
Torren’s brother, Caspar, returns to Dr. Hester’s house. Caspar is a roamer, a person who travels about the devastated countryside looking for abandoned junk that he can sell. Torren longs to accompany his brother, but is told that he is too young. He is jealous of Maddy, a woman Caspar has asked to join him.
Lina overhears Caspar talking about finding a city. She wonders if it is the city she has often dreamed about. When Caspar sets off again, Lina leaves a note for Mrs. Murdo and hides in his wagon. She thinks the trip will only take a few days. Caspar is not happy when he finds her, but Maddy convinces him that Lina will be useful in the city. She is small and can crawl into places that they cannot. Caspar is searching for the treasure mentioned in many old songs and rhymes.
Torren is angry with his brother for leaving. Early one morning, he runs among the fields until he comes to a crate of tomatoes. Frustrated, he throws a tomato, pretending it is a bomb that will kill Lina and all the people of Ember. He destroys two crates of the fruit.
When the destruction is later discovered, Torren claims he saw Doon throwing them. The people of Sparks are furious at the waste of food. The people of Ember know that Doon would never do such a thing.
Then Tick, a boy from Ember who is a little older than Doon, begins to stir up trouble. He encourages the other Emberites to demand more food. He says the people of Sparks treat them poorly, and they should rebel. A few days later, a hateful message is scrawled on the walls of the hotel.
Ben Barlow, one of the town leaders, starts to pressure the others in town into forcing the people of Ember to leave the town sooner than six months. He does not care that it will be winter soon and the refugees will have no shelter or food.
Things get worse in Sparks. Someone leaves piles of rotten fruit and branches on the steps of the hotel. The people of Ember clean it up, but later begin to itch with a horrible rash. The branches were poison oak. Tick calls for action. He wants the Emberites to arm themselves with the metal bars from their bathrooms. They will demand the people of Sparks treat them fairly, or they will attack.
Lina is devastated when she sees the city. She knows it is not the one in her dreams. It is a ghost town. Late that night, Maddy wakes her and the two girls take bikes from Caspar’s truck and set off back to Sparks.
They meet a friendly roamer who allows them to scavenge with him. He also sings Lina the rhyme that made Caspar search for treasure. It tells of a city the people should remember, and a treasure buried underground. Lina realizes the song was about Ember. When the founders of Ember built their underground city, they spread the song as a way to help those left above ground to remember them. Lina and Maddy again set off for Sparks, arriving just as a war is about to begin.
The city leaders vote two to one to throw the people of Ember out of Sparks. Tick demands they fight for the right to stay. The two groups face off outside the town hall. Ben Barlow brings out a horrible weapon. It is an old machine gun. As Tick calls for the Emberites to fight, Ben starts shooting the gun, but Mary Waters aims it above the people’s heads.
As Ben tries to re-aim it, it explodes and catches the great pine tree on fire. Torren is trapped in the tree, but Doon helps him to escape. As the flames catch the town hall on fire, Lina rushes forward to help the people of Sparks put it out. Soon, most of the Emberites, except Tick and his close followers, are also assisting to put out the fire.
Once the flames are out, the two groups learn the truth. Torren writes a letter admitting that Doon did not throw the tomatoes, and Kenny says he saw Tick put the piles of poison oak on the hotel steps. The city leaders decide that although rations will be small, they have enough food stored for everyone to share it through the coming winter. Especially when Mrs. Murdo tells them about her crop of winter squash that can soon be harvested.
Caspar returns to Sparks for a short visit and brings Torren an old lightbulb. It is useless because they do not have electricity. Doon, however, using a magnet that Lina found, has made a small generator. He learned how from the books he read. He borrows Torren’s lightbulb, and everyone is shocked when Doon makes it glow. Lina sees it as a hopeful sign that things will be better in the future.