Don't run! Make yourself look big by opening your coat or holding your pack above your head or wave your arms frantically. If you have kids, keep them close to you. A bear is a predator that, like most predators, is looking for an easy meal, so you want to appear like you are not worth the effort. Then, start backpedaling slowly while shouting.
Most bear researchers recommend that if the bear is moving in to pursue you, then throwing your pack while moving off diagonally in the other direction may work as a last-ditch effort for getting away. The bear will hopefully be distracted by your pack and its contents long enough to allow you some distance to escape.
A great book on the subject was written by Canadian bear biologist Stephen Herrero, called Bear Attacks: Their Causes and Avoidance . It contains information and case studies on both grizzly and black-bear-attack survivors, and I highly recommend it if you spend time in bear country. I also can't recommend enough the importance of talking to the locals at the ranger station when you are going to be hiking in bear country, especially in grizzly-bear country. They can tell you about any problem areas to avoid camping in as well as any current threats in the region.
Also, carry a whistle on the shoulder strap of your pack after a chance encounter with a bruin. I was hiking with a friend in a remote canyon south of Flagstaff in the spring one year when we happened upon a black bear. As we crested the top of a slope in the canyon and pushed through a thick stand of willows, we surprised a black bear drinking from a small tinaja (a water hole in the sandstone). We had been making noise and talking, and I think the bear was as startled to see us as we were him. The waterhole was only eight feet across, so we were in bad-breath distance of the bear and close enough to see droplets of water falling from his jowls--too close for my comfort.
As if orchestrated, my hiking partner and I both threw our hands up at the same time and began shouting in an attempt to scare off the bear. Short of frightening him, we seem to have disrupted his morning drink enough, and he slowly turned and walked the other way, eventually disappearing into a grove of box elders. My buddy and I then sat and took a three-hour lunch break to give the bear plenty of time to move on.