Move your arms up and down slowly as your sides. Retreat slowly backwards. Talk slowly and quietly to the bear. Look for cubs. Be prepared for a charge.
Tree climbing to avoid bears is popular advice.
All black bears, all grizzly cubs and some adult grizzlies can climb trees if the spacing of the branches is right. Running to a tree may provoke an otherwise uncertain bear to chase you. Bears can run up to 40 mph over short distances. If you do climb a tree, make sure you pick a good one and climb at least 15 feet up. If the bear charges you, freeze.