While occasionally well enough to go on family outings, he was still too weak to shoot or even dribble a basketball.

But the game was never far from Riley’s mind. His teammates, coaches, teachers, and other friends from Boston College High School visited him constantly. And varsity basketball head coach Bill Loughnane told Riley the spot that he had earned on the team the previous season was waiting for him.

Riley’s parents and pediatric oncologist Dr. Dan Benedetti left the decision of trying to get back on the court for the 2016-17 season up to Riley, and in the end he made it — playing all winter for an Eagles team that advanced deep into the state playoffs and finished with a 20-3 record.

“At the beginning of the season I could barely get up and down the court, but now I feel like I’m holding my own,” says Riley, who is also a junior honor roll student at BC High. “I still have trouble getting my wind, and need a few more breathers — but I know how lucky I am. A lot of kids have it much worse.”

Less than a year has passed since pain in Riley’s abdomen sidelined him last April. Tests revealed a mass that doctors at Boston Children’s first thought might be a gastrointestinal ailment, until surgery confirmed it was cancer. The news was shocking to Riley, his parents, and younger sister, Connaught, but Benedetti says the fact the cancer had not spread further throughout the teen’s body meant that the length of his treatment was shorter — and his chance of cure higher. His passion for basketball didn’t hurt, either.

“For Spencer’s age and type of lymphoma, there is typically an excellent survival rate, and his cancer responded very well to the treatment,” says Benedetti. “Spencer’s body needed to recover from both a red blood cell and a body muscle mass standpoint after the chemotherapy for him to play competitive sports, but having something like basketball to motivate him made a huge difference in giving him direction and focus.”

Support at school and home also helped. Teacher Nick Argento organized a letter-writing campaign that flooded the teen’s hospital room with well-wishes, and despite their concerns over his rail-thin, 6-foot-4 frame, Riley’s parents let him push himself to the limit physically.

“We told him to work as hard as he could — and we’re amazed at how strong and stoic he has been,” says mom Megan Riley. “Dr. Dan told us that this was the cancer they could treat the best, so we all just put our heads down and got through it together.”

Dad Sean Riley admits he was in awe of his son’s willpower, and says he is proud that he has started a Cancer Awareness Club at BC High to teach other teens how to deal with the disease when it impacts their families. “Spencer has shocked us every step of the way,” Sean says. “And whenever we had a tough day in the hospital, the wonderful nurses had a way to make it better.”

Coach Loughnane says that Riley’s story inspired the team throughout the season — and even before it. “In the spring, summer, and fall, while our kids were working hard to get in shape, thinking about what Spencer was going through was a big motivator,” says Loughnane.

The Riley family fondly remembers when BC High teammates surprised him by attaching green ribbons to their warm-up jerseys in honor of the teen — and then wore them onto the court before a game.

“Everybody has been supportive, and it means so much,” Riley says. “It’s changed my views about life. I enjoy the little things more, and I want to do what I can to help others.”

That, and help BC High reach the playoffs again next year.

This story originally appeared on the Dana-Farber Cancer Institute’s Insight blog.