He makes noise, warning the bear, and stands between the tourists and the bears. One of the tourists comment that they'd feel safer inside their car. Not long after, the bear begins running toward the Park Ranger, and he quickly reacts by laying down a cloud of bear spray. Mama bear turns around, taking her cubs with her. When she begins to reconsider, the Park Ranger throws a rock harmlessly near her, which is met by a chorus of tourists saying "awwww!" and what must look, to them, like a trio of cuddly teddies.
Most importantly, the Park Ranger does not turn and run, which will frequently induce a bear's instinct to chase.
Though we've heard criticisms of bear spray's effectiveness, it looks to have worked to deter this particular Yellowstone bear. And this Park Ranger's calm thinking help to give this story a happy ending.
See the video below: