CBS Corporation announced on Wednesday that the ailing 92-year-old media mogul Sumner M. Redstone had resigned as executive chairman, and that Leslie Moonves, the company’s chief executive, would assume the role of chairman.

The resignation of Mr. Redstone went into effect on Tuesday, the company said, and he was appointed chairman emeritus.

A lawsuit challenging Mr. Redstone’s mental competence had raised questions among analysts and investors about whether Mr. Redstone should continue as executive chairman of CBS and Viacom. Mr. Redstone controls about 80 percent of the voting stock in the two companies.

As of Wednesday, Mr. Redstone remained executive chairman of Viacom, the entertainment company that includes the MTV, Comedy Central and Nickelodeon cable networks and the Paramount Pictures film studio.

Carl Folta, a spokesman for Viacom, said that the Viacom board was scheduled to meet Thursday, when it is likely that directors will discuss Mr. Redstone’s role at the company.

Deal Professor: As Viacom Struggles, Questions About Current and Future ControlOCT. 21, 2015
Judge Orders Medical Examination of Sumner RedstoneJAN. 22, 2016
Court Filing Challenges Competence of Sumner RedstoneNOV. 25, 2015
Doubts Circle Viacom, Vanguard of YesteryearOCT. 6, 2015
The shift at CBS came after Mr. Redstone sent a letter Tuesday to Mr. Moonves and CBS directors announcing his resignation, according to one person briefed on the developments who requested anonymity because they were private.

The board subsequently met Wednesday and first offered the chairman position to Mr. Redstone’s daughter, Shari. Ms. Redstone, who now is vice chairwoman of CBS and Viacom, declined and nominated Mr. Moonves for chairman. The board voted unanimously for the appointment.

“I have been fortunate to work with Les and he has clearly established himself as a creative and effective leader who understands both the challenges and the opportunities that are shaping today’s media landscape,” Ms. Redstone said in a statement. “I am sure he will make a great chair and I look forward to working with him for many years to come.”

Mr. Moonves, one of the most highly regarded TV executives, has been president and chief executive of CBS since 2006. He will continue in those positions.

“I want to thank Sumner for his guidance and strong support over all these years,” Mr. Moonves said in a statement.

Mr. Redstone controls the voting stock in Viacom and CBS through his private holding company, National Amusements. If Mr. Redstone dies or is found to be incapacitated, his stake in National Amusements is to be held by a trust. Voting control will go to seven trustees. Those trustees include Ms. Redstone and Philippe P. Dauman, chief executive of Viacom.

In a separate statement, Ms. Redstone confirmed that the terms of her father’s trust state that she succeed him as nonexecutive chairwoman at both CBS and Viacom.

Separately, Ms. Redstone had made a deal with Mr. Moonves for him to take on the chairmanship at CBS, according to people briefed on the discussions.

Ms. Redstone has not made a similar arrangement with Mr. Dauman at Viacom, according to two people. She is said to have not seen eye-to-eye with his stewardship of the company, which has struggled amid the digital upheaval transforming the industry.

In her statement on Wednesday, Ms. Redstone hinted that she would not support Mr. Dauman as chairman.

“It is my firm belief that whoever may succeed my father as chair at each company should be someone who is not a trustee of my father’s trust or otherwise intertwined in Redstone family matters, but rather a leader with an independent voice,” she said.