A Staten Island couple says they unearthed a box of buried treasure right in their own back yard.

Matthew and Maria Emanuel say they were excited after finding a rusted, rotting metal box submerged in dirt at their Wooddale Avenue home while having new trees planted.

But they were then stunned to learn the box was actually a safe with $52,000 worth of valuables inside — including wads of wet $100 bills and baggies stuffed with diamonds, gold and jade.

“I thought, ‘We found buried treasure!’ ” Matthew Emanuel told the Staten Island Advance. “We were freaked out. It’s something you can’t make up.”

Also inside the safe was a Brooklyn address written on a note inside one of the bags — which the Emanuels linked to one of their neighbors.

“We realized it must have been them, so Monday morning, I walked on over to their house and knocked on their door,” Matthew Emanuel said. “I asked them if they’d ever been robbed.”

The neighbors said they had — nearly seven years ago, he said.

The NYPD confirmed that the safe was stolen during a burglary at the neighbors’ home in 2011, according to CBS.

The owners of the safe declined to comment — but were thrilled to have their stuff returned, the Emanuels said.

“She was like shaking and hugging me,” Matthew Emanuel said of the woman.

Maria Emanuel added, “A couple of people asked us, ‘Why did you return it?’ It wasn’t even a question. It wasn’t ours.”

The safe’s owners blamed the robbery on Robert Costanzo, the notorious “Ninja Burglar” who was convicted of 160 robberies on Staten Island, the Advance reported.

But the Staten Island DA’s Office couldn’t say whether Costanzo was responsible.