RIYADH (Reuters) - A suicide bomber was killed and two people were wounded in a blast near the U.S. consulate in Saudi Arabia's second city of Jeddah early on Monday, state TV said, the first bombing in years to attempt to target foreigners in the kingdom.

The attacker parked his car outside a hospital opposite the consulate at about 2.15 a.m. and detonated his device after being approached by two security men, killing him and lightly wounding them, it said, quoting a security spokesman.

Three further blasts rocked the location of the bombing hours later, a witness told Reuters, as police carried out what appeared to be controlled explosions near the site.

A video sent by the witness showed police taking cover behind vehicles and covering their ears before a blast.

In a statement, the U.S. consulate said there were no casualties or injuries among its staff, adding that it and the U.S. embassy were in contact with Saudi authorities investigating the incident.

Reuters could not immediately reach officials for further details. A photograph on the Sabq news website showed what appeared to be the remains of a man lying beside a taxi.

State television avoided direct reference to the presence of the diplomatic mission, mentioning only the street address, an apparent effort to downplay the likely target of the attack.

A State Department message to U.S. citizens in Saudi Arabia reiterated advice to keep aware of their surroundings and take extra precautions when travelling.

The witness said the area had been closed off by security forces, with helicopters hovering overhead. The explosion appeared to have taken place about 20 m (65 feet) from an outer checkpoint of the consulate, he added. Concrete barriers protect the street outside the consulate.

Islamic State has carried out a series of bombing and shooting attacks in Saudi Arabia since mid-2014 that have killed scores of people, mostly members of the Shi'ite Muslim minority and security services.

A decade ago, an al Qaeda campaign focused on Western expatriates in the world's top oil exporter, killing hundreds in attacks on businesses and residential compounds. One 2004 attack hit the U.S. consulate in Jeddah, killing nine.

(Reporting by Angus McDowall, additional reporting Tom Finn in DOHA and Ahmed Tolba in CAIRO; Editing by Michael Perry and Clarence Fernandez)