Whenever two boats try to occupy the same water at the same time, a right of way situation exists. When this happens, one boat is obligated to give way to the other. The boat that is supposed to give way is Called the give way vessel and the other one is called the stand on vessel The stand on vessel should keep to its course so the skipper of the give way vessel can get out of the way without collision. There are specific rules to use in determining which vessel is which.
Motor vs. Sail: A motor boat is any vessel using an engine regardless of whether it is a sailboat or a motorboat. A sailboat is considered to be a motorboat even if the SailS are up as long as the engine is running. A sailboat that is sailing generally has the right of way over motorboats. But there are some exceptions.
Rules for Sailboats
Port Tack vs. Starboard Tack

Anytime Two Sailboats Are On Opposite Tacks - The Boat On Starboard Tack
Has The Right Of Way
Windward vs. Leeward

Anytime Sailboats Are on the Same Tack The Boat Most To Leeward Has Right
of Way
Overtaking - The overtaking vessel should give way regardless of tack
or whether sailing or motoring. The notable exception to this rule is in the
case of large vessels that are confined to the channel due to draft. Even at
minimum speed, ships usually move faster than sailboats, therefore you should
keep an eye out behind your boat as well as ahead.
Overtaking Vessels

Overtaking Boats Give Way to Boats Being Overtaken
General Rules - Whenever there is a risk of
collision and it appears that the give way boat is not taking appropriate action,
it is the duty of the stand on boat to avoid the collision by altering course.
Having the right of way is a poor excuse for having a collision - alterations
in course to avoid a collision should be made obvious enough so that the other
skipper can see what you are doing. Sometimes you can tell if you are on a collision
course by the compass bearing to the other vessel. If the bearing remains steady,
collision is imminent unless someone changes course.
Sometimes it is difficult to see in all directions on a sailboat, especially
when sailing close hauled. The jib can block 25% of view from the cockpit. The
area of obstruction occurs on the leeward side from straight ahead to abeam.
It just so happens that when you are close hauled or close reaching, sailboats
close hauled or close reaching on the opposite tack will remain within this
blind spot sometimes right until the time of collision. It's important to have
a crew member keep an eye out to leeward when ever the jib obstructs your view.