Lewis Hamilton and his Mercedes team have plenty of work to do after Ferrari emerged as the early leaders in practice ahead of the Bahrain GP on Sunday.During the two sessions which took place on Friday, the world champion could finish no higher than fourth in the second 90 minutes of running as mistakes and a general lack of performance left him on the back foot.Instead, it was his rivals who claimed top spot with Red Bull's Daniel Ricciardo initially leading the way in an unrepresentative first practice before the Scuderia moved ahead under the lights, as Kimi Raikkonen marginally led teammate Sebastian Vettel.The main factor was tyres, as is usually the case in Bahrain, with the drivers struggling to extract the optimum performance over a full lap.For Mercedes in particular, the problem was losing grip in the technical middle sector which caused the tyre to overheat more and mean they fell further behind in the final part of the track.Compare that to Ferrari and also Red Bull who have better pace in the first two sectors and are able to maintain more grip at the end of the lap.Ricciardo's final position of fifth was also skewed as a near-miss with Valtteri Bottas at Turn 4 ruined his attempted flying lap on the supersoft compound. Teammate Max Verstappen had a difficult day in general, losing all of the first session to an electrical problem, which left him pushing his car back to the pits.As a result, he was left playing catch up compared to the rest and had trouble getting his tyres working as he looked to do a low-fuel run.Without the various interfering factors a close battle is on the cards with Ferrari certainly looking the team to beat for now but Mercedes and Red Bull are right on their tail.The midfield too is looking ultra-competitive with just 1.2 seconds covering the 11 drivers from P7 to P18.Renault's Nico Hulkenberg led that group as one of the surprises of Friday, Pierre Gasly, comfortably featured inside the top 10 in both practices, with the Toro Rosso driver ending the day eighth overall.McLaren still look steady with Fernando Alonso and Stoffel Vandoorne a long way off their lofty target in ninth and tenth but have moved ahead of Haas, as Romain Grosjean and Kevin Magnussen slipped down the order.Grosjean was P6 in the earlier session but was 11th by the end while Magnussen dropped all the way to 15th.Carlos Sainz was 12th in the second Renault in front of the two Force Indias as the Silverstone-based team looks to make improvements after a slow start to the 2018 season.The two Sauber's and two Williams' continued their battle over the minor places towards the back as Brendon Hartley was 1.6 seconds slower than his Toro Rosso teammate Gasly as he brought up the timesheets.