Yes you can use your capital loss to offset your gain and also offset up to $3,000 of other income.
You report both sales on Schedule D; line 1 for the stock held one year or less and line 8 for the stock held more than one year.
In general capital losses are first used to offset capital gains and then used to offset other income up to $3,000 per year. Any unused losses are carried forward to the following year where they are used to offset capital gains and up to $3,000 of other income. This continues year after year until the loss is used up or death occurs. Hopefully you won't have any more losses but I thought I would mention it just in case.