in this case, barely would be used to say that he was able to buy the computer, but he almost didn't have enough. Maybe he had exactly the right amount or just a but of extra money afterwards.
'He was almost out of money in the bank, but he needed a computer. After counting all of his money, he realised that he could just barely afford the computer. So he bought it, and was left with three dollars in the bank.'