MADRID—Reaching into a stainless steel tray, Francisco Fernandez-Aviles lifted up a gray, rubbery mass the size of a fat fist.

It was a human cadaver heart that had been bathed in industrial detergents until its original cells had been washed away and all that was left was what scientists call the scaffold.

Next, said Dr. Aviles, “We need to make the heart come alive.”

Inside a warren of rooms buried in the basement of Gregorio Marañón hospital here, Dr. Aviles and his team are at the sharpest edge of the bioengineering revolution that has turned the science-fiction dream of building replacement parts for the human body into a reality.