“The Discreet Hero” by Mario Vargas Llosa. (Farrar Straus Giroux)

For decades, the acclaimed Peruvian novelist Mario Vargas ­Llosa has split himself into two personalities: There is Vargas Llosa, the author of dazzling political novels such as “Conversation in the Cathedral” and “The Feast of the Goat.” Then there is Vargas Llosa, the author of two titillating sexual fantasies, “In Praise of the Stepmother” and “The Notebooks of Don Rigoberto.”

Vargas Llosa has long kept the imaginative territory of his serious political works fenced off from the hedonistic frivolities of Don Rigoberto. With good reason: The 2010 Nobel Prize in literature was bestowed upon Vargas Llosa mostly for “his cartography of structures of power and his trenchant images of the individual’s resistance, revolt, and defeat.” It’s hard to fathom how the hilarious Rigoberto, who enjoys role-playing games with his wife, would fit into that high-minded rubric. Instead, Vargas Llosa’s favored recurring character in the political novels is a noirish police detective named Lituma, who last appeared fighting the Shining Path guerrillas in “Death in the Andes” (1993) and could easily fit into a gritty television series such as “The Wire.”

But now that Vargas Llosa is 79 and has won the greatest literary prizes in the world, perhaps he thought, Why not? Rigoberto and Lituma never actually meet in his new novel, “The Discreet Hero,” but their appearance between the same hard covers represents a kind of singular all-star performance, where champions from rival teams finally play together in a bawdy tragicomedy that proves that the Peruvian master is still at the top of his narrative game.

The novel opens in Piura, a little city made modern by Peru’s economic rejuvenation. Don Felícito Yanaqué’s fortunes have risen with the tide. The son of an illiterate tenant farmer, he has built a thriving transportation company. On the first page of the book, he finds a letter demanding $500 a month in protection tacked to his front door. When he brings the note to the police, Sgt. Lituma tells him, “This is the result of progress, sir.”

Wealth is the mother of crime. But Lituma’s philosophical attitude does little to soothe Yanaqué as he scrambles to figure out whom he can trust: The sluggish police? His ­smoking-hot mistress? His dutiful sons? His disaffected wife? He knows one thing for certain: He’ll never give the extortionists a penny, even if it costs him his life.

Meanwhile, in alternating chapters, Don Rigoberto’s quiet pursuit of pleasure is frustrated by the attacks of two upper-class “hyenas” — the delinquent twin sons of his boss, Ismael Carrera. The twins are determined to nullify Carrera’s recent marriage to his brown-skinned maid, which has provoked a furor among the Peruvian tabloids and has effectively cut the twins out of millions. The pair easily bribe the capital’s judiciary, so their primary target becomes Rigoberto, who witnessed the marriage and refuses to testify against the sanity of his octogenarian friend. All of Lima’s high society sides against him because “they can’t forgive Señor Ismael for marrying a chola.” Threats, kidnapping and blackmail ensue.

“My God,” Rigoberto thinks after the latest turn of the screw, “what stories ordinary life devised; not masterpieces to be sure, they were doubtless closer to Venezuelan, Brazilian, Colombian, and Mexican soap operas than to Cervantes and Tolstoy.” Anyone who knows Vargas Llosa’s work understands that this line is meant as both compliment and defense. For years he has held the juicy 19th-century novel of action above the bloodless musings of the modernists. In “The Perpetual Orgy,” his 1975 analysis of Flaubert’s “Madame Bovary,” he confesses, “The greater the role that rebellion, violence, melodrama, and sex, expertly combined in a compact plot, have played in a novel, the greater its appeal has been to me.”

The emphasis should be read on “expertly combined.” “The Discreet Hero” is an exquisite concoction, a delicious melodrama of sex and betrayal, love and revenge. But what technique is needed! While real television soap operas are shaggy and plodding, Vargas Llosa’s novel is swift, seamless and as structurally symmetrical as a diamond. It has more in common with Mozart’s opera buffa than with “Days of Our Lives.” The novel is set up around three authoritarian, self-absorbed fathers: Carrera, Yanaqué and Rigoberto. But my favorite character, perhaps Vargas Llosa’s greatest character of all time, is Rigoberto’s son, Fonchito. Described as “a viper with the face of an angel” in “The Notebooks of Don Rigoberto” (1997), Fonchito has grown up a bit here. He’s now 15 and obsessed with the Bible, but he’s lost none of his puckish ways. “This boy is like quicksilver,” a priest declares after meeting him. Nobody can tell if his new interest in religion is sincere or an elaborate game. “Could you tell me what this Sodom and Gomorrah is, Papa?” he asks Rigoberto innocently one afternoon.

Critics have long referred to Don Rigoberto as Vargas Llosa’s alter ego, but I’d vote for this provocative little trickster: a brilliant fabulist who’s always three steps ahead of everyone else.

Valdes writes about Latin American culture and arts.