But after back-to-back time-outs were called and with the game on the line, Barbosa knocked both free throws off the rim.
After a series of free throws by each team in the remaining seconds, Turkey emerged with the two-point win and advanced to the second round following its third straight win in Group C.
Guard Serkan Erdogan scored 21 points to lead Turkey, while Barbosa was Brazils top scorer with 26 points.
Erdogan, who plays for Spanish club Tau Ceramica, was 4 for 9 from the two-point line and hit four of his 10 3-pointer attempts.
Turkey plays winless Qatar on Wednesday while Brazil takes on Greece.