Magician Cesareo Pelaez’s greatest trick was motivating generations of performers to stage “Le Grand David’’ at the Cabot Street Cinema Theater in Beverly for more than 35 years, which the Guinness Book of World Records termed the longest consecutively running stage magic show in the world.

A quirky throwback to the golden age of magic that Mr. Pelaez saw as a boy growing up in Cuba, the show was born in 1977 when he was teaching psychology at Salem State College and imparting the theories of his mentor during his graduate studies at Brandeis University, Abraham Maslow, who proposed the hierarchy of needs theory.

“He was one of a kind,’’ Stan Allen, publisher of Las Vegas-based Magic Magazine, said of Mr. Pelaez. “He comes to America and he has this dream of doing a show. These young people join this dream with him, and they manage to keep that show successful for the next 35 years. There are no shows like that anywhere else in the world, at least not in magic.’’

Mr. Pelaez, acclaimed in the magic industry for performing in the long-running show as Marco the Magi, died of congestive heart failure Saturday in the Kaplan Family Hospice House in Danvers. He was 79 and had lived in Beverly.

A charismatic psychology instructor at Salem State for 24 years, Mr. Pelaez was both a stern patriarch and nurturing therapist who helped people discover their talents, friends said, and inspired them to excel.

“He used to say what we do when we perform on Sundays is make an appointment with our best selves,’’ said magician David Bull, who performs as Le Grand David in the show and began as Mr. Pelaez’s apprentice in the early 1970s. “This idea that you leave all of your daily grievances, self-pity, and soap opera at the door, reach inside and perform with what each individual thought of as their higher self . . . that was very Maslow.’’

As Marco the Magi, Mr. Pelaez wore opulent robes as he made tables levitate and enchanted audiences with his Cuban accent. He was a master of a classic illusion involving linking rings. His mysterious routine could shift into vaudeville as he tossed off his robes to reveal a 1920s bathing suit. Le Grand David then sawed him in half.

“He was a miracle man when it came to putting that show together,’’ Goulet recalled. “He selected the choreography, the sets, the effects. He was the captain of the ship. He could be very strict. If he didn’t have that mannerism, the show would never have ran.’’

Goulet said Mr. Pelaez got the best from his performers. “It was like digging into a dish. He would dig into that person’s mannerisms and find out what they excelled in,’’ he said.

In a statement about his life history, Mr. Pelaez described his theater troupe as an embodiment of Maslow’s theories:

“The whole company, including myself, needed to understand what Abraham Maslow wrote at the end of his book ‘Toward a Psychology of Being’: ‘It is not adaptation to disability that we must strive for in redefining health. It’s transcendence of disability.’ And we are learning together about health as transcendence of environment.

A poster from ‘‘Le Grand David’’ show.

“The artistic whole is the result of the relationships between the members of the ensemble and their relationships with me. Nothing is hidden from the audience. What they perceive is the truth of our relationships with each other - that creates the fiber of the show. The fiber of the show is what we are at a cellular, a molecular level. The rest - the costumes, sets, staging, music, dance - is an expression of this.’’

Born in Santa Clara, Cuba, Mr. Pelaez was the son of a businessman who immigrated to Cuba from Spain and ran an import-export business. Mr. Pelaez could recall sitting on his father’s lap while they watched magician Fu Manchu, a Dutch conjurer known for shows bursting with color, comedy, and illusion, according to Bull.

As a boy, Mr. Pelaez began staging shows for playmates with his older sister Elisa playing piano. She died in 2004.

He graduated from Universidad Central de Las Villas in Cuba with an undergraduate degree in psychology and was studying to become a diplomat when the Cuban revolution began. Fleeing first to Colombia, he moved to the United States in 1962. Mr. Pelaez took a summer job as a counselor at Camp Greylock in Western Massachusetts, where a camper’s father helped him get a job in a furniture factory in Keene, N.H.

He spoke little English and later told friends that he was ostracized by the factory workers. Mr. Pelaez later got a job teaching Spanish in a public school in Keene. Lonely and adrift, he wrote a letter to Maslow at Brandeis about his plight. Maslow offered him work as a teaching assistant, and Mr. Pelaez spent six years at Brandeis, graduating in 1982 with a master’s degree.

Mr. Pelaez never married. He was separated from the love of his life when he fled Cuba.

“He reconnected with her after 55 years when she was a grandmother,’’ Bull said. “By both Cesareo and her accounts, they would have married if not for the revolution.’’

In Beverly where he lived, Mr. Pelaez was celebrated for spearheading the group that bought and preserved the Cabot Street Cinema Theater. His theater troupe also bought and rejuvenated an antique playhouse nearby called the Larcom Theater in 1985. A spring season of “Le Grand David’’ is scheduled to open in April.

“The guy was terrific,’’ said Mayor William F. Scanlon Jr. of Beverly. “He was one of the finest minds I’ve ever encountered. He was a great leader. He had all of those folks associated with the magic show wanting to do the best they could every performance. He cared a great deal about this city.’’

A funeral Mass will be said at 9 a.m. Saturday in St. Mary Star of the Sea Church in Beverly. Burial will be in St. Mary’s Cemetery.

Mr. Pelaez received numerous awards and honors from groups in the magic world.

“He was an incredible mentor,’’ said Katie Bull of Beverly, a longtime member of the theater company. “He had this knack of providing opportunities for people within the theater experience that fit all these different people’s abilities and allowed for incredible growth.’’