One of the most desperate PIIGS makes a comeback

Pig Snout

Everyone loves a good comeback story. And if you were to look for one right now in the euro zone, most economists would point to Spain.

The country, which represents the "S" in "PIIGS," a term coined as a catch-all for Europe's most troubled economies, is growing at its fastest pace in seven years—3.1 percent in the second quarter. Of the other PIIGS—Portugal, Italy, Ireland and Greece—only Ireland is growing faster.

While European Central Bank policy played a role in kick-starting growth in the euro zone's fourth-largest economy, it's not the only factor.

Read More Greece: What to know about the snap election

Far before ECB President Mario Draghi made his famous "whatever it takes" speech in 2012 about the central bank's intention to preserve the euro, Spain was working on a recovery by implementing unpopular structural reforms, undertaking painful austerity measures, and reducing the number of nonperforming loans at its top banks. Spanish families have been putting away money—net savings reached an all-time high relative to GDP in 2014.

The Spanish consumer is starting to spend. Spanish auto sales jumped 24 percent in the month of June and 23.5 percent in July. Auto analysts say much of that growth is because of the subsidy scheme from the Spanish government that incentivizes new vehicle purchases.

"Spain is doing fine, austerity is over, reforms are working to some extent. Expect growth around 3 percent, helped also by [the] rebound in the real estate market from big bust before," Holger Schmieding, chief economist at Berenberg Bank, told CNBC.

Spanish banks have been shedding nonperforming loans and are showing signs of loan issuances improving. Given the weak lending landscape, though, analysts say there is still a lot of room for improvement.

More business are also being started, thanks at least in part to steps taken by the government of Prime Minister Mariano Rajoy to make it easier for entrepreneurs to build a company and get a business license. Spanish entrepreneurs still complain that there's a lot of red tape, however.

Greece's receding from the headlines is also a welcome development for Spain, especially holders of Spanish debt, said Peter Chatwell of Mizuho Securities.

Tourism has also been a boon for the economy. According to industry organization Frontur, Spain saw more than 29 million foreign visitors in the six months to June, up about 4 percent year over year.

Read More When an Airbnb rental becomes a horror story

Certainly, however, the country still faces big economic problems. Its unemployment rate is still bad by any standard, at 22.4 percent. And a number of the jobs that have been created recently are temporary or part time.

One factor that could shape Spain's economic fate is the election in November, at which RBS says political risks persist.

While Podemos, the anti-austerity party many times compared to Greece's Syriza, has been losing steam in recent polls, traditional parties such as the People's Party (the current governing party), and Spanish Socialist Party (PSOE) have regained some momentum.

Alberto Gallo of Royal Bank of Scotland pointed out that under the Spanish electoral system, a national proportional majority doesn't automatically guarantee any party enough seats in the lower house and Senate. And given the number of parties running, there is the likely chance of a coalition outcome.

Coalitions could spell trouble for the economy. "They won't agree on anything, and that will stop reforms from being passed," said Daniel Lacalle, CIO of Alpha Strategy and former senior vice president at Pimco.

At this point, all the parties are promising higher spending. Higher public spending runs the risk of a higher deficit, which analysts caution could trump a recovery.

"It's a lethal combination, increasing public spending and increasing taxes. Because what happens historically [in Spain] is that they spend more than what they bring in from taxes … revenue from taxes don't cover the increase in spending so the deficit widens," Lacalle said.

Read More European stocks lose steam; earnings in focus

Not all market participants are bullish on Spain. JPMorgan says Spain's exposure to Latin American is a risk and could result in volatility for shares, especially as the U.S. Federal Reserve nears an interest rate hike. JPMorgan has kept Italy as its top pick.

In the meantime, Spain's major stock index market, the IBEX 35, is flat this year, underperforming the Stoxx Europe 50, which is 6.5 percent higher.

—CNBC's Santiago Saez Moreno contributed to this story.

JefferiesAnd the Best Place to Work in the global financial markets 2016 is...

Register for Financial Markets News Alerts