Arthur Medici, born in Brazil, was boogie boarding with his girlfriend's brother off Newcomb Hollow Beach in Wellfleet at about 12 pm when he was knocked off his board and attacked by a shark.
His friend took him to the shore where CPR was performed on him and people at the scene reportedly tried to make a tourniquet to stop the blood flow.
He was taken to a Cape Cod Hospital in Hyannis where he subsequently died, State Police spokesman David Procopio said in a statement.
Police responded at the scene immediately after the attack.
The details of his injuries have not been revealed. The beach has been closed following the attack.
Medici came to the United States two years ago to attend college, according to WCVB.