Winchester's Rob Moore and his Great Britain teammates survived a tense finish to book their place in an Olympic
semi-final for the first time since they won gold in 1988.
They secured the point they needed in a 1-1 draw with Spain to finish second in Pool A and now go on to meet Holland in the last four.
Ashley Jackson scored his fifth goal in as many games to give his side a lead late in the first half and even though Pau Quemada converted a second-half set-piece allowing Spain to pile on some
late pressure, Britain can, like their women, look forward to a semi-final on home turf.
Unlike in their draw with Australia, GB were able to take the game to their opponents in the first half.
A penalty corner effort from James Tindall rebounded high to Jackson, who took one touch but fired into the side of the net.
Spain tried an over-complicated move from their first set-piece midway through the half but the double-switch to Xavi Lleonart was comfortably dealt with by Cannock's James Fair.
Towards the end of the half GB began to find a rhythm and when Iain Lewers drove a cross in from the right the deflection by 19-year-old Harry Martin, who has grown in stature during the
tournament, almost took goalkeeper Francisco Cortes by surprise.
But two minutes before the break Jackson struck with a low penalty corner threaded between Cortes and Juan Fernandez, who was still looking where the ball was when it rebounded off the backboard.
Cortes was more alert in the last minute to tip over Tindall's snap-shot on the turn from Martin's deflected cross.
The match almost turned on two penalty corners.
Firstly, from the breakdown at another Jackson set-piece Tindall turned Barry Middleton's shot onto the crossbar before, with 16 minutes to go, Pau Quemada beat Fair inside his right-hand post.
Roc Olivia had another corner deflected wide as Spain sensed their chance and they thought it had duly arrived two minutes from time when they won two corners in quick succession but Fair stood
tall to deny Quemada.
There was some frantic - and at times desperate - badgering of the umpires in the closing couple of minutes as Spain pushed forward and thought they had at least twice won penalty corners but the
hosts did enough to get the job done.
At the final whistle Spain coach Dani Martin raced onto the pitch to confront the officials but his protestations were to no avail.