The former treasurer of Rajoy's Popular Party, Luis Barcenas, said he handed 25,000 euros (USD 33,000) in 500-euro notes to the prime minister in March 2010, said sources present in the hearing, who asked not to be named.
Barcenas was answering questions by a judge at Spain's High Court in a scandal that has rocked the government.
He handed to the court papers detailing the slush fund and "declared that he was the author of the documents" published in newspapers which showed secret payments to Rajoy in the 1990s and 2000s, one of the sources told reporters.
"He said the whole party leadership received envelopes" of undeclared cash, the source said.
Rajoy, in power since late 2011, today ruled out resigning over the scandal, in which he has denied any wrongdoing.
Barcenas is currently jailed pending investigations into a separate corruption affair implicating senior members of the party.