Only a decade ago, Spain was on the periphery of world production, making movies that, as with Pedro Almodovar’s 2019 Cannes competition contender “Pain and Glory,” occasionally sold worldwide.

Now, thanks to an OTT and digital TV revolution, Spain has become a burgeoning global production center.

Take, for instance, Oriol Paulo’s drama “Durante la Tormenta” (“Mirage”), in which a young wife and mother faces the loss of her beloved or the birth of her daughter.

Released in Spain on Nov. 30 by Warner Bros. Pictures, “Mirage” earned a quite modest $867,593. Yet in China, it opened No. 3 on March 27 and grossed $15.9 million.

A Netflix acquisition, the Atresmedia-Think Studio production has moreover gone on to be the only foreign-language movie singled out by Netflix in its April first quarter results, having “seen broad viewing across the world.”

Signs of success were spotted in 2011, when “Gran Hotel,” an original Spanish series, made a strong showing with Latin American audiences despite Castilian accents. From then, Spanish productions have discovered an audience of 477 million in the Spanish-speaking world, reached most directly by global streaming platforms. In April 2018, “La Casa de Papel” (“Money Heist”) was confirmed by Netflix as its most-watched non-English language series ever — one reason for the streamer to open its first European production hub in Madrid a year later.

Such seems the opportunity-strewn but still uncertain present and immediate future of Spanish cinema.

Movistar +, the pay TV unit of Telefonica, bowed its first original series in September 2017, and now plans 19 new or returning scripted shows for release in 2019.

“No other telecom in Europe is investing so heavily in European original productions as Telefonica,” says María Rua Aguete, at global market research firm IHS Markit.

This revolution is primarily seen in the TV business. But it is spilling over into cinema.

“The launch of streaming services is driving a paradigm change. Theatrical box office is less of a metric of success,” says Carlos Fernández at Spanish production-distribution-sales house Filmax.

The key question is how to react. Last year, European public broadcasters France Televisions, Germany’s ZDF and Italy’s RAI launched the Alliance to counter Netflix and other global streaming platforms. Now private broadcasters are also teaming up, at least in a first phase, on single projects. In a pilot test case, Spain’s Mediaset España and France’s TF1 have joined to produce “Way Down,” a Spain-set bank heist adventure thriller with Freddie Highmore, star of “The Good Doctor,” 2018’s top U.S. scripted series export.

Given the TV feeding frenzy for high-end series, “casting Spanish feature films nowadays is extremely complicated, finding a director almost impossible,” says Ghislain Barrois at Mediaset España production-distribution hub Mediterraneo.

“Co-production allows broadcasters to make bigger films with bigger stars and spread the risk,” he adds.

Telecinco Cinema and Atresmedia Cine, the movie production arms of Mediaset España and Atresmedia, respectively, have produced, with independent companies, eight of the 10 highest-grossing Spanish theatrical releases last year in Spain.

“In the Spanish theatrical market, there’s still a space for titles made with the big broadcasters,” says Fernández.

But established broadcasters and producers are already looking not just to compete but also partner with new platforms. Of Spain’s six or so biggest productions of 2019, three at least are backed by either Movistar + — including two of Spain’s biggest films at Cannes: Alejandro Amenabar’s “While at War” and animated feature “Dragonkeeper” — or Netflix: “Klaus,” the streamer’s first original animated feature.

“Spanish films are very successful, much-watched on Movistar +,” says the service’s Domingo Corral. “Just as with series, we want to have exclusive movies which mark us apart, stories with a sense of risk which enrich our value proposition for clients.”

“At least some of the exciting or positive news about the Spanish film industry will be coming from these new players,” says producer Simon de Santiago, of Mod Producciones, co-producer of “While at War.”

Yet the Spanish industry confronts one curveball which, though seen as positive in principle by the industry, risks huge collateral damage if handled badly: the transposition into Spanish law of the E.U. Audiovisual Media Services Directive (AMSD). This will oblige streaming platforms to carry 30% Spanish/European content and, if national governments require, invest a percentage of revenues from a country in local production.

Currently running at 3% of annual revenues for Spanish or E.U. films, that obligation in Spain has turned big broadcasters Mediaset España and Atresmedia into driving forces of Spanish movie production.

It’s assumed that for Spain, the AMSD would include both a content and investment quota for new platforms.

“The discussions we’re having are more about what kind of investment Netflix, Amazon, Apple or other streamers will make, rather than whether they’ll be obliged to invest,” says José Nevado, at Spain’s main AEC producers association.

Those directives could have an equal impact when applied to streaming platforms.

Netflix currently carries 3,059 hours of Spanish or European content, 16% of its total offer, meaning it would need to add 2,677 more hours to meet a 30% quota, according to Ampere Analysis.

The big question is how the AMDS should be enshrined in Spanish law.

“I don’t know if the market can take $500 million or $200 million in new investment,” says Barrois.

Crucial issues include whether producers will be able to share IP rights to productions made with those platforms, while building company asset value and not being relegated to the status of service providers, [as] productions lose a sense of cultural identity, says Nevado.

One suggestion is that original productions on which global platforms take 100% of rights should not count towards quotas, he adds.

The AMSD looks like one of the big issues of 2019, for Spain and the rest of the E.U.