Toto Wolff says the timing of the all-important Virtual Safety Car period at the Spanish Grand Prix was "beautiful" for Mercedes and helped the team make a "magic" call on Lewis Hamilton's strategy.

Hamilton was beaten into Turn 1 by Ferrari's Sebastian Vettel but stayed close in the opening stint, forcing the championship leader into a stop. While Vettel took on another set of the quicker soft tyre, Mercedes extended the stints of Hamilton and Valtteri Bottas, eventually putting medium tyres on the former and using the latter to hold up the charging Ferrari for four laps.

A key moment in strategy for both teams came on lap 34, as Stoffel Vandoorne crashed into Felipe Massa at Turn 1, beaching his McLaren in the gravel and triggering a VSC period, slowing the speed of every driver to a delta lap time. The removal of the car took three crucial laps and Mercedes waited until the last moment of it to pit Hamilton -- the VSC ended as he crossed the white line in the pits -- to prevent Ferrari capitalising on the slower speeds by mirroring their call.

Explaining the thought process, Wolff said: "At the start we planned to go for the default strategy, which was to put the medium tyre on, then the softs at the end to attack, hopefully attack, and then the VSC came in. That was beautiful, for our process in the strategy group, at that stage we planned to do the opposite to Sebastian and then the magic call was the one to pit Hamilton at a time when it looked like the VSC would end so because Sebastian couldn't react in that case.

Mark Sutton/Sutton Images

"So we timed it perfectly, credit to James [Vowles, chief strategist] and the strategists, and that pit stop obviously was much faster than Sebastian's afterwards, and that was down to Lewis to take him on track and it was very tight on the exit with Sebastian, quite some racing going on there and obviously a very, very brave move, then on the straight and taking the lead."

After Hamilton's stop, Ferrari pitted a lap later and Vettel emerged wheel to wheel with Hamilton, holding position with a firm defensive move at Turn 1. But Mercedes' strategy had given Hamilton a tyre advantage for the final stint and he soon got by, before starting to manage his soft tyres until the end.

However, with the lead pair lapping everyone up to third-place man Daniel Ricciardo, Wolff admits Mercedes were still wary of Ferrari pitting Vettel for a fresh set of softs for a late charge at the end and told Hamilton to drive accordingly.

"When of course that there was a possibility at the end we had a long debate about whether Ferrari would do another pitstop and put softs just to try and hunt us down, so we tried to have a pitstop gap of 2.5s in order to be able to react. In the end I think it was a balance, it was balancing on a knife's edge because you want to have the gap to avoid the undercut, but on the other side we had to make the tyres last 32 laps and it was just a big combination of team work and strategy and Lewis' driving."