President Donald Trump dressed up as himself, complete with his trademark red tie, for his first Halloween in the White House.

Trump and first lady Melania Trump greeted some of the 6,000 children and adults who were invited for trick-or-treating at the White House on Halloween eve.

Children from more than 20 schools in the District of Columbia, Maryland and Virginia attended the festivities on the South Lawn, along with military families and members of unspecified community organisations.

Spooky music played over loudspeakers. Machines cranked out fog. Pumpkins carved with the likenesses of past presidents decorated the south entrance of the White House.

Black spiders hung from webs spun between the portico's columns. A sign over an awning proclaimed "Halloween at the White House 2017".

Trump and the first lady, who wore a calf-length coat in the crisp air, welcomed dinosaurs, athletes, police officers, skeletons and more.

Trick-or-treaters took home individual gift bags containing presidential M&Ms, a home-baked cookie and other candies.

Trump and his wife chatted with the children, with the president at times going in for a high-five or posing for photos, including with White House press secretary Sarah Huckabee Sanders and her family.

"Sarah, get in here," the president said as her kids lined up for a photo.

Mrs Trump wished trick-or-treaters a "Happy Halloween."