Cisco promised a turnaround. Is this it?

November 15, 2011, 10:00 AM UTC

By Kevin Kelleher, contributor

FORTUNE — Few companies have been as central to the Internet’s development as Cisco. ISPs, private companies and public institutions have relied on its switches and routers so much that the San Jose company’s name might as well be synonymous with the Net’s infrastructure.

But for several years, Cisco (CSCO) has been struggling to find a suitable second act. At the dot-com peak, Cisco was briefly the most valuable company in the world, with a market cap of $500 billion. For most of the past 10 years, it’s stock has vacillated in a range of $15 and $30 a share. And in recent years, things have slowed even more: Its quarterly revenue has risen only 8% over the past three years, while net profit declined 44%. More worrisome to investors, its gross margins deteriorated year after year as competitors battled Cisco in the core markets that made it a giant.

So when Cisco, in reporting its earnings for the quarter ended October 29, said that gross margins came in at 62.4%, it caused a stir among analysts and investors. After all, that ratio is below the 64.3% of a year ago and even the 62.7% of the previous quarter. But instead of falling, Cisco’s stock rallied 8% over the next two days, reaching its highest level in nine months.

That’s because most investors were bracing for even weaker margins — something closer to 61%. Competitors like Hewlett-Packard (HPQ) and Juniper Networks (JNPR) have been waging a price war in switches and low-end routers, trying to boost volume in the face of a weak global economy. That has put a steady weight on Cisco’s gross margins, which were closer to 65% in 2010 and around 70% several years ago.

CEO John Chambers had vowed to stem the decline and shift the company’s focus from revenue growth to higher gross margins. It was a cornerstone of a three-year restructuring he had engineered to shore up Cisco’s profits. And it looks like the restructuring is finally working — at least for now.

There were other mildly encouraging signs. Revenue from switches, a third of the total, was flat, but orders increased by 10%. Overall, orders increased 13% in a seasonally weak quarter — including a 10% increase in orders from the cash-strapped public sector, reversing a 4% decline in the previous quarter. Even orders from the Europe and Middle East rose 13%.

None of these metrics recall the glory days of Cisco’s youth in the late-1990s. But they paint a portrait of a middle-aged tech giant in the early stages of a successful turnaround amid a skittish global economy. Turning around a tech giant like Cisco is no mean feat. IBM pulled it off, but it did so by pushing from hardware into services and consulting. That’s not an option for a networking equipment maker like Cisco. Only a fifth of its revenue comes from services, largely customer support.

Cisco is also recovering from a couple of costly missteps it made in recent years. As routers and switches became low-cost commodities, Cisco moved into new markets: teleconferences, set-top boxes, the Flip camcorder. But some moves proved ill-advised. The company was also slow to take seriously the competition that HP and others were presenting to its core market.

That changed this year. Cisco sold off set-top box operations, killed the Flip camera and began laying off as many as 10,000 workers. It began getting tough with its competitors, including a snarky web site with videos poking Juniper for its product delays. For the first time, sales teams were paid according to their contributions to gross profit. “We are more aggressive on the competition, we are going to be tough on our competitors, whether they are Juniper or HP and Huawei and Avaya, and it’s something that I think, we were a little bit to general on in the past,” Chambers said in the earnings conference call.

Meanwhile, Cisco is seeing growth in newer areas. Revenue grew 13% from video systems for ISPs, 12% from collaboration services like video conferencing and enterprise social networks and 107% from the data center division.

In February, after Cisco posted yet another disappointing quarter, Chambers told the street that the pieces were in place to turn the company’s financial performance around. Many analysts scoffed, and the stock price sank. But in retrospect, Chambers may have been right. Three analysts upgraded their ratings on Cisco last week, and others lifted their price targets.

Still, some concerns remain. Analysts at Barclays and Merrill Lynch said it was too early to declare Cisco’s turnaround a sure thing. HP and Juniper are distracted with their own problems, and once those are sorted out they could wage another price war in switches and routers.

That may be, but Cisco still has an advantage of being the first of these companies to get its house in order. It’s made several difficult moves this year and seems serious about doing what is necessary to keep the turnaround going. That might not be the second act Cisco imagined for itself, but it may just be compelling enough to keep investors in their seats.