Mick McCarthy kicked off his second stint in charge of Ireland with a slender 1-0 win in the reverse fixture at the end of March but hopes of a significantly more routine victory on home turf failed to materialise.
They were indebted to an own goal from Joseph Chipolina to secure all three points shortly before the half-hour mark, with Robbie Brady adding injury-time gloss to the scoreline.
The result makes it three wins from four in Group D, but McCarthy knows his side will have to improve dramatically if they are to progress at the expense of Denmark or Switzerland.
Ireland started sluggishly and were reduced to efforts from distance before Chipolina's unfortunate intervention after 29 minutes handed the hosts the lead.
David McGoldrick scuffed Seamus Coleman's low cross towards goal, with the Gibraltar defender inadvertently deflecting the ball past a helpless Kyle Goldwin.
The lively Callum Robinson came close to adding a second on the stroke of half-time but his whipped effort from outside the penalty are arched just wide of Goldwin's right-hand post.
Another low ball from Coleman caused chaos in the Gibraltar box after 58 minutes but McGoldrick was unable to steer his effort past Goldwin.
Gibraltar's goalkeeper then kept out Scott Hogan's fierce drive from a tight angle before McGoldrick whipped a right-footed effort against the post from 18 yards 20 minutes from time.
The host added a scarcely deserved second in stoppage time, Brady stealing in at the back post to head in James McClean's cross as McCarthy's side maintained its unbeaten run in extremely underwhelming fashion.