In the first book, From the Earth to the Moon, by Jules Verne, published in 1865
This is basically dwardio's answer, but technically there were dogs in a spaceship in the first book, 5 years earlier.
In chapter 23, the ship design is being discussed, where we see that Barbicane intends to take two dogs with him.
There now remained only the question of air; for allowing for the consumption of air by Barbicane, his two companions, and two dogs which he proposed taking with him, it was necessary to renew the air of the projectile.
In chapter 25, we see a discussion about taking cows and such, which settles on taking just two dogs, as well as some seeds to grow.
Ardan wished to convey a number of animals of different sorts, not indeed a pair of every known species, as he could not see the necessity of acclimatizing serpents, tigers, alligators, or any other noxious beasts in the moon. "Nevertheless," he said to Barbicane, "some valuable and useful beasts, bullocks, cows, horses, and donkeys, would bear the journey very well, and would also be very useful to us."
"I dare say, my dear Ardan," replied the president, "but our projectile-vehicle is no Noah's ark, from which it differs both in dimensions and object. Let us confine ourselves to possibilities."
After a prolonged discussion, it was agreed that the travelers should restrict themselves to a sporting-dog belonging to Nicholl, and to a large Newfoundland. Several packets of seeds were also included among the necessaries. Michel Ardan, indeed, was anxious to add some sacks full of earth to sow them in; as it was, he took a dozen shrubs carefully wrapped up in straw to plant in the moon.
In chapters 26 and 27 we see that the spaceship does, in fact, depart.
Murchison followed with his eye the hand of his chronometer. It wanted scarce forty seconds to the moment of departure, but each second seemed to last an age! At the twentieth there was a general shudder, as it occurred to the minds of that vast assemblage that the bold travelers shut up within the projectile were also counting those terrible seconds. Some few cries here and there escaped the crowd.
"Thirty-five!— thirty-six!— thirty-seven!— thirty-eight!— thirty-nine!— forty! FIRE!!!"
Instantly Murchison pressed with his finger the key of the electric battery, restored the current of the fluid, and discharged the spark into the breech of the Columbiad.
An appalling unearthly report followed instantly, such as can be compared to nothing whatever known, not even to the roar of thunder, or the blast of volcanic explosions! No words can convey the slightest idea of the terrific sound! An immense spout of fire shot up from the bowels of the earth as from a crater. The earth heaved up, and with great difficulty some few spectators obtained a momentary glimpse of the projectile victoriously cleaving the air in the midst of the fiery vapors!
At the moment when that pyramid of fire rose to a prodigious height into the air, the glare of flame lit up the whole of Florida; and for a moment day superseded night over a considerable extent of the country. This immense canopy of fire was perceived at a distance of one hundred miles out at sea, and more than one ship's captain entered in his log the appearance of this gigantic meteor.
In chapter 28, it's confirmed that the spaceship has achieved moon orbit.
That very night, the startling news so impatiently awaited, burst like a thunderbolt over the United States of the Union, and thence, darting across the ocean, ran through all the telegraphic wires of the globe. The projectile had been detected, thanks to the gigantic reflector of Long's Peak! Here is the note received by the director of the Observatory of Cambridge. It contains the scientific conclusion regarding this great experiment of the Gun Club.
LONG'S PEAK, December 12. To the Officers of the Observatory of Cambridge. The projectile discharged by the Columbiad at Stones Hill has been detected by Messrs. Belfast and J. T. Maston, 12th of December, at 8:47 P.M., the moon having entered her last quarter. This projectile has not arrived at its destination. It has passed by the side; but sufficiently near to be retained by the lunar attraction.
The rectilinear movement has thus become changed into a circular motion of extreme velocity, and it is now pursuing an elliptical orbit round the moon, of which it has become a true satellite.
Technically, we never see the dogs put into the capsule before launch. However, the sequel's first chapter assures us they were.
As ten o'clock struck, Michel Ardan, Barbicane, and Nicholl, took leave of the numerous friends they were leaving on the earth. The two dogs, destined to propagate the canine race on the lunar continents, were already shut up in the projectile.
The spaceship in question was launched via a giant cannon. In modern spaceflight theory, this seems pretty absurd. However, it was a plausible suggestion at the time, and isn't really that much different in concept from a rocket strapped to your backside.
The spaceship is propelled into space, where it achieves moon orbit. I feel like that's plenty sci-fi to qualify as an answer to the question.