Replying to Baroda's first innings total of 254 all out, the hosts resumed day two on 18 for no loss and eventually took an upper hand by the time stumps were drawn.
UP were 301 for six at the end of the second day's play, already having a lead of 47 runs, with Alam not out on 100 and Amir Khan on three here at the Green Park stadium.
Overnight batsmen -- openers Tanmay Srivastava and Mukul Dagar, after resuming the day on 10 and 4, respectively – failed to provide a solid platform to the team as both of them got out cheaply.
Dagar was the first one to get out at an individual score of 13, while Srivastava (23) soon followed his partner.
Captain Suresh Raina (25) and Parvinder Singh (11) also could not get going, even as one-down batsman in Mohammad Kaif held on to his wicket at one end.
At 94 for four, the hosts were in trouble, still needing 1601 runs to overtake their opponents' first innings score.
But Kaif found an able support in Alam and together they managed to steady the boat.
The duo put on an 160-run stand for the fifth wicket before Kaif valuable innings came to an end. His 83 off 205 balls was studded with six hits to the fence.
By the Kaif fell, UP had already equalised Baroda's first innings score.
Alam then continued with Piyush Chawla for a while before the latter got dismissed for 23. Alam's unbeaten ton came off 201 balls and with the help of 12 fours.
For Baroda, Gagandeep Singh was the pick of the bowlers with three for 62.
Baroda 1st inngs: 254
UP 1st inngs: 301 for six in 94 overs (Arish Alam batting 100, Mohammad Kaif 83; Gagandeep Singh 3/62).