Crude Oil ( ) Brent Crude ( ) Natural Gas ( ) S&P 500 ( ) PHLX Oil ( )

Dick Costolo, Twitter’s embattled chief executive, is stepping down, the company said on Thursday.

Jack Dorsey, the company’s co-founder and chairman, will serve as interim chief executive while the board searches for a permanent successor.

The change is effective July 1. Twitter shares were up more than 7 percent in after-hours trading immediately after the news was announced.

Since Twitter’s debut as a public company in 2013, Mr. Costolo has repeatedly disappointed Wall Street as the company struggled to attract new users, refine its products and develop new forms of advertising.

Mr. Costolo’s departure is likely to renew speculation that Twitter is an acquisition target for the handful of tech giants that could afford the company, which currently has a market valuation topping $24 billion. In recent weeks, Google has been rumored to be eyeing Twitter, but people with knowledge of the companies denied that a deal was in the works.

“The situation at Twitter must be much worse than it appears, as replacing the C.E.O. is such a big step,” said Brian Blau, an analyst with Gartner. “Twitter’s problems are clearly not over, and while Jack Dorsey knows Twitter well, they really should bring in some outside perspective as most of their strategies so far are not working out so well.”

The analyst firm eMarketer estimates that Twitter’s monthly user base will grow 14.1 percent this year, down from 30 percent two years ago. By 2019, its worldwide user growth rate will be 6 percent, according to the firm.

Twitter accounted for 3.6 percent of the $19.2 billion mobile Internet ad market in the United States last year, according to eMarketer, while Facebook held an 18.5 percent share and Google dominated with 36.9 percent.

“I am tremendously proud of the Twitter team and all that the team has accomplished together during my six years with the company,” Mr. Costolo said in a statement on Thursday. “We have great leaders who work well together and a clear strategy that informs our objectives and priorities. There is no one better than Jack Dorsey to lead Twitter during this transition.”

Pressure on Mr. Costolo grew in recent weeks after Chris Sacca, an early Twitter investor, went public with an 8,500-word analysis of what Twitter could be and how it could get there.

Shortly after the essay was published on Mr. Sacca’s blog, Mr. Costolo fielded some tough questions from Twitter stockholders at the company’s annual shareholder meeting.

Mr. Sacca’s manifesto calls for a much deeper rethinking of Twitter’s service, which is still focused on 140-character text messages, to attract new users beyond the 302 million active users it reported for the first quarter.

“Twitter can afford to build the wrong things,” Mr. Sacca wrote. “However, Twitter cannot afford to build the right things too slowly.”

After Mr. Sacca posted his letter, Robert Peck, an analyst at SunTrust Robinson Humphrey, said that if Twitter’s financial results disappointed investors again in July, as they had for the last two quarters, “we think it’s possible that the company may look to make some changes” in leadership.

Twitter said on Thursday that its second-quarter financial results were on track to meet its previous forecasts.

Twitter, founded in 2006, has never been known for its stable management, with plots and counterplots among its founders and early executives.

Mr. Costolo became chief executive in October 2010 as part of a boardroom coup against Evan Williams, Twitter’s co-founder and then-chief executive. Mr. Williams remains on the board and is one of the company’s biggest shareholders. He will be part of a search committee for a new chief executive.

Last year, much of Mr. Costolo’s executive team was fired or resigned as he sought to speed up the company’s pace of product improvements.

Mr. Costolo told Twitter’s board about six months ago that he thought it was time for it to start thinking about succession.

When meeting with advertisers at the Consumer Electronics Show in Las Vegas in January, it was clear he was tiring of the stresses of the job, according to a person with knowledge of the discussions who spoke on the condition of anonymity.

Mr. Costolo and the board eventually agreed he should step down before a successor was found to allow for a public search process, this person said.

Mr. Dorsey, who preceded Mr. Costolo as chief executive, is deeply familiar with the company and its products. He is also the chief executive of Square, a tech start-up he founded in 2009 that specializes in online payments and has its headquarters in the same San Francisco office building as Twitter.

This is the second rise to Twitter’s top ranks for Mr. Dorsey. After being ousted as chief executive and replaced by Mr. Williams in 2008, Mr. Dorsey returned to Twitter as executive chairman in 2011 when Mr. Williams himself was pushed out of the chief executive’s office, replaced by Mr. Costolo.

But ever since his ouster in 2008, Mr. Dorsey has wanted to return to the helm of Twitter, according to two people with knowledge of his thinking. While he has retained a board seat during Mr. Costolo’s tenure, Mr. Dorsey has angled to become more prominent in his influence on Twitter’s direction, these people said.

Mr. Dorsey will continue as chief executive of Square and will not be on the search committee for a new Twitter boss, according to a person with knowledge of the matter.

As rumors swirled around Mr. Costolo, Twitter insiders have divided into camps regarding who should replace him.

Adam Bain, who oversees global revenue and partnerships, is a particular favorite for the top job among many Twitter employees, according to multiple people inside of the company. Mr. Bain, a longtime media industry executive who worked at Fox Interactive Media, has strong relationships with many of Twitter’s media partners.