Granisetron works by inhibiting the action of serotonin, a natural substance in the body that can induce vomiting. By blocking serotonin from binding to its receptors in the chemoreceptor trigger zone and the gastrointestinal tract, granisetron effectively prevents the nausea and vomiting associated with cancer treatments.