By Benjamin Pimentel, MarketWatch

SAN FRANCISCO (MarketWatch) -- Shares of Hewlett-Packard rallied Tuesday on a J.P. Morgan Chase & Co. upgrade, while Facebook Inc. gained on news that it is conducting a test on video ads, but the tech sector was weighed down by losses in shares of Twitter Inc. and Apple Inc.

H-P (HPQ) was up 2% closing at $27.45 after J.P. Morgan analyst Mark Moskowitz raised his rating to buy, telling clients in a note that while "challenges remain" for the Palo Alto, Calif.-based tech giant, they "are easing."

For example, Moskowitz said the personal computer market appears to be stabilizing, and he also pointed to signs of improvement in the printer market.

Facebook (FB) also was up 2% to close at $54.86 after the social network announced that it was conducting a test of video ads this week, confirming speculation that it was considering rolling out the ad format seen by analysts as a potentially rich revenue source.

Other gains came from Intel Corp. (INTC) which was up 1%, closing at $24.66, while Cisco Systems (CSCO) climbed 1.2% to close at $20.92. But the tech sector was weighed down by shares of Twitter Inc.(TWTR) which shed 0.3% to close at $56.45 and Apple Inc. (AAPL) which was off 0.5% to close at $554.99.

The Nasdaq Composite Index (RIXF) was down 0.1% to close at 4,024. The benchmark ended the week with a 0.6% gain. The Morgan Stanley High Tech 35 Index (MSH) was up 0.2%, while the Philadelphia Semiconductor Index (SOX) was up nearly 1%.

More MarketWatch technology stories

Facebook to test user reactions to video ads

Apple says Beyonce surprise album fastest-selling ever on iTunes

Subscribe to WSJ: http://online.wsj.com?mod=djnwires

HP (NYSE:HPQ)
Historical Stock Chart
Von Jun 2024 bis Jul 2024 Click Here for more HP Charts.
HP (NYSE:HPQ)
Historical Stock Chart
Von Jul 2023 bis Jul 2024 Click Here for more HP Charts.