The world champion headed Mercedes team-mate Nico Rosberg by 0.377 seconds, with Williams' Valtteri Bottas third, 0.661secs off the pace.
But Hamilton also brushed the wall twice at Turn Three on the slippery street track.
Red Bull's Daniel Ricciardo was the first driver to crash, hitting the barrier at the difficult Turn 15.
Ricciardo lost control on the exit of the left-hander, one of the corners highlighted by leading drivers as a safety concern in the build-up to the race.
Rosberg and McLaren's Jenson Button said they were concerned about the lack of run-off at Turns Three, Seven and 15 - and Ricciardo hit the impact-absorbing barrier that protects the wall at a corner where the exit drops off downhill at a slight negative camber.
The incident, which tore off his right rear wheel and suspension, brought out the red flag with 22 minutes of the session remaining.
It capped a difficult day for Red Bull, after Ricciardo's team-mate Max Verstappen managed only seven laps before being stopped by an oil leak caused by a clutch problem, according to team boss Christian Horner.
The session restarted for 13 minutes and Toro Rosso's Carlos Sainz immediately had a much smaller-scale accident at the same place - the Spaniard locked up on the way in, was heading for the escape road, decided to have a go at making the corner and then caught his front wing on the barriers, breaking its mountings.
Hamilton almost suffered the same fate as Ricciardo, after hitting the wall side-on, on two consecutive flying laps.
Both times, Hamilton got away with it, although the second incident led to him locking his brakes and damaging his set of tyres, bringing his session to an end.
Earlier, the world champion, who is nine points behind Rosberg in the championship after winning the past two races, put on an impressive performance over the first half-hour of the session.
As is often the case, he went much faster much earlier than Rosberg in unfamiliar conditions - his first flying lap was 1.4secs quicker than the German's, despite Hamilton not even having walked around the track beforehand, and done only six laps on the simulator.
After four flying laps, Hamilton was 0.926secs quicker than Rosberg, and then lowered his time again by nearly another second, after which his team-mate finally got to within 0.3secs of him.
When both drivers swapped the soft tyre for the faster super-soft, Hamilton was again faster on both his flying laps, before the incidents with the wall.
Bottas was the fastest driver to use soft tyres to set his best time, while McLaren's Fernando Alonso, an official ambassador for the race, was an unexpected fourth, also on the soft tyre.
The Spaniard was a second faster than team-mate Button in seventh, although some of that margin may have been down to the Spaniard getting a slipstream down the straight from Esteban Gutierrez's Haas.
Ferrari's Sebastian Vettel and Force India's Sergio Perez split the McLarens, with Williams' Felipe Massa eighth from Sainz and Force India's Nico Hulkenberg.
European Grand Prix first practice results
European Grand Prix coverage details
Lewis Hamilton set the pace in first practice at the inaugural European Grand Prix at Baku in Azerbaijan.