Juan Goytisolo, one of Spain’s most celebrated writers, whose experimental, linguistically audacious novels and stories savaged his country’s conservatism, both religious and sexual, and gloried in its Moorish past, died on Sunday at his home in Marrakesh, Morocco. He was 86.

His death was announced by his literary agency, Carmen Balcells, which did not state the cause.

Mr. Goytisolo (pronounced goy-tee-SO-lo) began his literary career in the mid-1950s with a series of realist novels, and in his 1959 essay collection, “Problems of the Novel,” argued for socially conscious realism.

With “Marks of Identity,” published in 1966, the first novel in a trilogy that explores a fictional version of his own life and 700 years of Spanish history, he broke free from his former manner. Rejecting realism, he developed a stream-of-consciousness, collagelike approach, and, in Joycean fashion, pushed relentlessly against the boundaries of the Spanish language.

“Marks of Identity,” which he called his “first adult novel,” reconstructs the past of an exile who returns to Barcelona after the Spanish Civil War, his life evoked through a swirl of memories, snippets of newspaper articles and police reports and interior monologues rendered in free verse.