Yes, the B Spec driver will pit either when it thinks it needs new tyres or it's running low on fuel. Occasionally it'll make a poor judgement by coming in to get tyres too early, for example, however for the majority of the time it's quite good at deciding when to come in.
It's worth noting that if you were running at increased pace before the pit stop (i.e. you were running at 2x or 3x), when you come out of the pits you'll be back at 1x