Amusingly, John Wiseman's classic SAS survival handbook has advice for this situation.
> You can sometimes sense that a lightning strike is imminent by a
> tingling in the skin and the sensation of the hair standing on end. If
> you are standing up, drop to the ground AT ONCE, going first to the
> knees with the hands touching the ground. If you should be struck,
> the charge may take the easiest route to the earth through your
> arms - missing the torso and possibly saving you from heart failure
> or asphixiation. QUICKLY LIE FLAT.
If you’re in an open powerboat, your best chance would be to apply full throttle and get the hell away from the storm as fast as you can, like the parent commenter did.
If you manage to find yourself in a lightning storm in a small, open sailboat, you’ve made a pretty big mistake, but essentially the same rule applies.
On larger vessels, if you’re belowdeck and aren’t touching anything metal, a lightning strike is usually a survivable incident, especially if your boat has a thoughtfully designed lightning protection system. All this involves is making sure you give the lightning a low-resistance path to ground through your boat’s keel and then the water that doesn’t run through anything expensive.
edit: I realize now maybe you didn’t mean specifically in the “on a boat” situation. Hopefully this comment is maybe interesting to fellow salty sea dogs. Yarr.
Assuming on land, not on a boat, as that's been covered elsewhere (just GTFO).
In a car: stay inside, doors closed, avoid touching the frame & such.
In an open field: crouch down with your feet together, don't put hands on the ground. Find lower ground if you can, e.g. a ditch. Don't lay down, keep your feet together.
Do not go under a tree. If you're around a lot of trees, best spot is as far from the base of any tree as the tree is tall.
And while we're here, if you ever hit a utility pole with your car hard enough to risk damage to the electrical wires, exit the car by hopping onto both feet together & letting go of the car before you land, and carefully hop away with both feet together. If you can't hop, do a very slow shuffle with feet together.