When I am backpacking on a weekend trip and I know there is going to be a chance of rain, I bring one of these rain covers along. Outdoor stores and backpack manufacturers make these, and I have found most to do the job quite well. I use a Gregory brand rain cover for my Gregory Deva 60 backpack, because the fit is very good.
Specialized backpack rain covers are heavier than plastic garbage bags, but they do the job better. They have a closer fit to the pack, and are of a sturdier nylon construction so they don’t tear if a branch from a tree snags your backpack.
REI has a generic pack cover called the Ducks Back Rain Cover, and it fits a variety of packs. If you can get a backpack cover designed specifically for your model of backpack, definitely go with that, otherwise a generic one like the Ducks Back will work fine too.
Luckily I have rarely used my rain cover, but on the occasional downpours I encounter on backpacking trips they come in very handy.
Happy hiking in the rain!