Before doing anything else, throw a Quick Ball. The first turn chance is always worth a shot.
Send out a good catching Pokemon. This means something that has False Swipe, and can inflict a status condition. Things like Gallade and Bisharp are good choices.
Whittle down the Legendary's HP with False Swipe, until it is at around 1 HP.
Inflict a status condition, preferably Sleep or Paralysis, as those cannot hurt the Legendary the way Poisoning and Burns do.
If the Legendary is in a dark place, or it is nighttime, throw Dusk Balls until you catch it, or the status condition you inflicted wears off.
If it is not in a cave and it is daytime, use Ultra Balls instead until you catch it, or Repeat Balls if you somehow managed to have the Legendary Pokemon before.
Enjoy your newly-caught Legendary.
Alternatively, just throw a Master Ball at it and save yourself the hassle. Also note that if the Legendary has a recovery move, make it a priority to inflict the status condition first, as that can cripple it, and may prevent it from using its recovery move.
Hope I helped!