US President Donald Trump said the United States was prepared for any possible "trouble" and its borders were secure , as authorities in Spain grappled with an attempted attack near Barcelona one day after another attack left more than a dozen dead.

"Homeland Security and law enforcement are on alert & closely watching for any sign of trouble. Our borders are far tougher than ever before!" Trump wrote in a post on Twitter on Friday.