Boeing said on Tuesday that its chief executive, W. James McNerney Jr., would step aside on July 1 and be succeeded by its second-ranking executive, Dennis A. Muilenburg, an aeronautical engineer who had widely been seen as the heir apparent.

Mr. McNerney, 65, has been the plane maker’s chairman and chief executive since 2005 and will remain chairman until next February. Mr. Muilenburg, 51, ran Boeing’s military business before being named the company’s president and chief operating officer in 2013. He also will join Boeing’s board.

Analysts said the transition was expected and came at a good time for the company, which has ridden a wave of orders for new and more fuel-efficient commercial planes to record highs in revenue and profit.

Mr. Muilenburg said in an interview that even though he spent most of his career in the military business, he had focused intently on the commercial plane unit over the last two years and was already working on its long-term concerns.