Miss Riley, in a break from filming gritty BBC2 drama Peaky Blinders in Manchester, visited her old school, the independent Teesside High in Eaglescliffe, to perform the official opening of its new sixth form building.
Next week Miss Riley starts the round of premieres for her new film, Edge of Tomorrow, which also stars Tom Cruise.
The 32-year-old said: "I have such good memories of my time at the school and it is lovely because when you come back those memories become more vivid.
"I'm still friends with a lot of the people at school and they all remember the old sixth form block. We used to have our own studies which we shared and would decorate them and it always smelt of microwaved food that we used to cook for ourselves at lunchtime.
"It was a wonderful time, with small, intimate classes which encouraged discussion and debate and a great bridge to university."
Miss Riley took the time to chat to excited pupils after she performed the opening ceremony.
The old sixth form block was a temporary structure, built in about 1980 to last for about five years - but was still standing until recently.
Head Deborah Duncan said one of the first things she wanted to do when she joined was replace the ageing buildings.
"When they started demolishing it I was so desperate to take the controls of the JCB," she said. "We desperately needed a modern, 21st century building that befits our excellent school, and now we have it."
Peter Barron, editor of The Northern Echo, who joined Miss Riley in performing the opening ceremony, said: "It is inspiring to come somewhere like here that is really on the up, and investing in the future of young people, and congratulations to Deborah and the governors for their vision in bringing this to fruition."
The new building has solar panels on the roof to provide renewable energy, extra insulation, cladding from sustainable, managed forests and low energy lighting.
Students have an outside terrace adjoining a common room, which overlooks the school's tennis courts, astroturf pitch, and the River Tees beyond. The building includes spacious classrooms, a kitchen and a quiet study area and it is hoped local groups and businesses will use the facilities at weekends, evenings and in the holidays.