Scientists say that they have shown how the brain can crack complex mental puzzles while its owner is sleeping.
A good night's sleep helped those struggling to remember
Research at Luebeck University, in Germany, says tests on 106 volunteers back up anecdotal evidence that a good night's sleep can help solve problems.
The volunteers were shown a number puzzle in which was embedded a "hidden code" revealing the answer, the journal Nature reports.
Those kept awake overnight reportedly had far less chance of solving it.
The scientists believe that because the brain appears to restructure information from the previous day during sleep hours, a period of sleep may produce insight into problems such as these.
Other experts say it is the first hard evidence that creativity and problem-solving may be assisted by the activity of the brain during sleep.
Dr Jan Born, who led the study, said: "This restructuring might be occurring in such a way that the problem is easier to solve."
He highlighted a period of sleep called slow-wave sleep - a deep sleep not thought to be punctuated by dreams.
Even small reductions in this sleep phase have been linked by other studies to a decrease in memory function, and in decreasing ability to recognise "hidden structures".
Their 106 volunteers were all given a quick look at a test that involved sorting numbers based on a couple of set rules.
However, underlying these rules was a third, "hidden" rule which, when spotted, dramatically simplified the completion of the puzzle.
Some of the volunteers then got a full eight hours' sleep, while others had various degrees of sleep deprivation.
The scientists then sat back to see which volunteers had a flash of inspiration and spotted the third rule and how quickly they managed it.
Twice as many of the rested participants caught on to the rule than volunteers from the sleepless group.
Dr Carl Hunt, director of the National Center on Sleep Disorders Research at the National Institutes of Health in the US, said that the study was important.
He said: "A single study never settles an issue once and for all, but I would say this study does advance the field significantly.
"It's going to have potentially important results for children for school performance and for adults for work performance."
It is estimated that many millions of Britons could be described as sleep deprived, and the average length of the nightly sleep has declined in recent decades.
Doctors Pierre Maquet and Perrine Ruby from the University of Liege wrote in an accompanying article that the results were a "warning".
"They give us good reason to fully respect our periods of sleep - especially given the current trend to recklessly curtail them."