Fetching details from the dictionary...

barely; narrowly; only just; with difficulty
かろうじて終電に間に合うことができた。
I barely made it to the last train.
試験にかろうじて合格してほっとした。
I was relieved to barely pass the exam.
かろうじて最終電車に間に合い安堵の息をついた。
I barely made the last train and breathed a sigh of relief.