Yes, as long as all four rules of castling are met, it is a perfectly legal move.